package com.cxfdemo.server.dao;
import java.lang.reflect.InvocationTargetException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.beanutils.BeanUtils;
import com.cxfdemo.server.domain.Merchant;
import com.cxfdemo.server.exception.DAOException;
import com.cxfdemo.server.service.main.DBGen;
import com.cxfdemo.server.service.util.DateFormatUtil;
import com.cxfdemo.server.service.util.H2BDUtil;
import com.cxfdemo.server.service.util.UUIDGenerator;
public class MerchantDAO {
private MerchantDAO(){}
public static MerchantDAO dao = new MerchantDAO();
public static String sql_Create
="insert into merchant(merchant_Id,merchant_Short_Name,merchant_Full_Name,merchant_Address,merchant_zip,merchant_fax,merchant_tel,create_Time,update_Time) values(?,?,?,?,?,?,?,?,?)";;
public static String sql_SelectByShortName
="select merchant_Id,merchant_Short_Name,merchant_Full_Name,merchant_Address,merchant_zip,merchant_fax,merchant_tel,create_Time,update_Time merchant from merchant where merchant_Short_Name=?";
public static String sql_SelectAll
="select merchant_Id,merchant_Short_Name,merchant_Full_Name,merchant_Address,merchant_zip,merchant_fax,merchant_tel,create_Time,update_Time merchant from merchant";
public static String sql_selectMerchantsByZip
="select merchant_Id,merchant_Short_Name,merchant_Full_Name,merchant_Address,merchant_zip,merchant_fax,merchant_tel,create_Time,update_Time merchant from merchant where merchant_zip=?";
public static String sql_selectMerchantsById
="select merchant_Id,merchant_Short_Name,merchant_Full_Name,merchant_Address,merchant_zip,merchant_fax,merchant_tel,create_Time,update_Time merchant from merchant where merchant_Id=?";
public Merchant selectById(String merchant_Id) throws DAOException{
Merchant m = null;
if(merchant_Id==null){return m;}
try {
Connection con=H2BDUtil.getConnection();
PreparedStatement pstm = con.prepareStatement(sql_selectMerchantsById);
pstm.setString(1, merchant_Id);
ResultSet rs = pstm.executeQuery();
for(;rs.next();){
m= new Merchant();
m.setMerchant_Id(rs.getString("merchant_Id"));
m.setMerchant_Short_Name(rs.getString("merchant_Short_Name"));
m.setMerchant_Full_Name(rs.getString("merchant_Full_Name"));
m.setMerchant_Address(rs.getString("merchant_Address"));
m.setMerchant_zip(rs.getString("merchant_zip"));
m.setMerchant_fax(rs.getString("merchant_fax"));
m.setMerchant_tel(rs.getString("merchant_tel"));
m.setCreate_Time(DateFormatUtil.formatDateOfDB(rs.getString("create_Time")));
m.setUpdate_Time(DateFormatUtil.formatDateOfDB(rs.getString("update_Time")));
}
con.close();
} catch (SQLException e) {
e.printStackTrace();
throw new DAOException("DAO Exception", e);
}
return m;
}
public List<Merchant> selectMerchantsByZip(String zip) throws DAOException{
List<Merchant> merchantList= null;
if(zip == null){ return null;}
try {
Connection con=H2BDUtil.getConnection();
PreparedStatement pstm = con.prepareStatement(sql_selectMerchantsByZip);
pstm.setString(1, zip);
ResultSet rs = pstm.executeQuery();
if(rs != null){ merchantList=new ArrayList<Merchant>();}
for(;rs.next();){
Merchant m= new Merchant();
m.setMerchant_Id(rs.getString("merchant_Id"));
m.setMerchant_Short_Name(rs.getString("merchant_Short_Name"));
m.setMerchant_Full_Name(rs.getString("merchant_Full_Name"));
m.setMerchant_Address(rs.getString("merchant_Address"));
m.setMerchant_zip(rs.getString("merchant_zip"));
m.setMerchant_fax(rs.getString("merchant_fax"));
m.setMerchant_tel(rs.getString("merchant_tel"));
m.setCreate_Time(DateFormatUtil.formatDateOfDB(rs.getString("create_Time")));
m.setUpdate_Time(DateFormatUtil.formatDateOfDB(rs.getString("update_Time")));
merchantList.add(m);
}
con.close();
} catch (SQLException e) {
e.printStackTrace();
throw new DAOException("DAO Exception", e);
}
return merchantList;
}
public Merchant selectByShortName(String shortName) throws DAOException{
Merchant m = null;
if(shortName==null){return m;}
try {
Connection con=H2BDUtil.getConnection();
PreparedStatement pstm = con.prepareStatement(sql_SelectByShortName);
pstm.setString(1, shortName);
ResultSet rs = pstm.executeQuery();
for(;rs.next();){
m= new Merchant();
m.setMerchant_Id(rs.getString("merchant_Id"));
m.setMerchant_Short_Name(rs.getString("merchant_Short_Name"));
m.setMerchant_Full_Name(rs.getString("merchant_Full_Name"));
m.setMerchant_Address(rs.getString("merchant_Address"));
m.setMerchant_zip(rs.getString("merchant_zip"));
m.setMerchant_fax(rs.getString("merchant_fax"));
m.setMerchant_tel(rs.getString("merchant_tel"));
m.setCreate_Time(DateFormatUtil.formatDateOfDB(rs.getString("create_Time")));
m.setUpdate_Time(DateFormatUtil.formatDateOfDB(rs.getString("update_Time")));
}
con.close();
} catch (SQLException e) {
e.printStackTrace();
throw new DAOException("DAO Exception", e);
}
return m;
}
public List<Merchant> selectAllMerchant() throws DAOException{
List<Merchant> merchantList= null;
try {
Connection con=H2BDUtil.getConnection();
PreparedStatement pstm = con.prepareStatement(sql_SelectAll);
ResultSet rs = pstm.executeQuery();
if(rs != null){ merchantList=new ArrayList<Merchant>();}
for(;rs.next();){
Merchant m= new Merchant();
m.setMerchant_Id(rs.getString("merchant_Id"));
m.setMerchant_Short_Name(rs.getString("merchant_Short_Name"));
m.setMerchant_Full_Name(rs.getString("merchant_Full_Name"));
m.setMerchant_Address(rs.getString("merchant_Address"));
m.setMerchant_zip(rs.getString("merchant_zip"));
m.setMerchant_fax(rs.getString("merchant_fax"));
m.setMerchant_tel(rs.getString("merchant_tel"));
m.setCreate_Time(DateFormatUtil.formatDateOfDB(rs.getString("create_Time")));
m.setUpdate_Time(DateFormatUtil.formatDateOfDB(rs.getString("update_Time")));
merchantList.add(m);
}
con.close();
} catch (SQLException e) {
e.printStackTrace();
throw new DAOException("DAO Exception", e);
}
return merchantList;
}
public Merchant createMerchant(Merchant m) throws DAOException{
boolean b = false;
Merchant mm = null;
try {
Connection con=H2BDUtil.getConnection();
m.setMerchant_Id(UUIDGenerator.getUUID());
Date d = new Date();
m.setCreate_Time(d);
m.setUpdate_Time(d);
PreparedStatement pstm = con.prepareStatement(sql_Create);
pstm.setString(1, m.getMerchant_Id());
pstm.setString(2, m.getMerchant_Short_Name());
pstm.setString(3, m.getMerchant_Full_Name());
pstm.setString(4, m.getMerchant_Address());
pstm.setString(5, m.getMerchant_zip());
pstm.setString(6, m.getMerchant_fax());
pstm.setString(7, m.getMerchant_tel());
pstm.setString(8, DateFormatUtil.formatDateOfDB(m.getCreate_Time()));
pstm.setString(9, DateFormatUtil.formatDateOfDB(m.getUpdate_Time()));
b = !pstm.execute();
if(b){
mm = new Merchant();
BeanUtils.copyProperties(mm, m);
}
con.close();
} catch (Exception e) {
e.printStackTrace();
b=false;
throw new DAOException("DAO Exception", e);
}
return mm;
}
public static void main(String[] args) thr
没有合适的资源?快使用搜索试试~ 我知道了~
webservice spring与CXF结合实现 实例和jar包都有
共184个文件
jar:81个
java:50个
class:38个
5星 · 超过95%的资源 需积分: 9 140 下载量 18 浏览量
2013-11-14
14:55:40
上传
评论 1
收藏 29.89MB 7Z 举报
温馨提示
webservice spring与CXF结合实现 实例和jar包都有 导入就可以用
资源推荐
资源详情
资源评论
收起资源包目录
webservice spring与CXF结合实现 实例和jar包都有 (184个子文件)
MerchantDAO.class 7KB
MerchantDAO.class 5KB
ObjectFactory.class 5KB
DBGen.class 4KB
Merchant.class 3KB
Merchant.class 3KB
DBGen.class 3KB
Merchant.class 3KB
IMerchantServiceImplService.class 3KB
WsXMLDateUtil.class 2KB
IMerchantServiceImpl.class 2KB
DateFormatUtil.class 2KB
DateFormatUtil.class 2KB
IMerchantServiceImpl.class 2KB
Main.class 2KB
IMerchantServiceImpl.class 2KB
IMerchantService.class 2KB
Main.class 2KB
Main_Spring.class 1KB
Main.class 1KB
Main.class 1KB
UUIDGenerator.class 1KB
UUIDGenerator.class 1KB
IMerchantService.class 1KB
H2BDUtil.class 1KB
H2BDUtil.class 1KB
FindMerchantByShortNameResponse.class 1009B
FindAllMerchantResponse.class 1007B
RegisterMerchantResponse.class 981B
RegisterMerchant.class 875B
FindMerchantByShortName.class 849B
FindAllMerchant.class 547B
IMerchantService.class 528B
ServiceException.class 464B
ServiceException.class 458B
DAOException.class 452B
DAOException.class 446B
package-info.class 265B
.classpath 7KB
org.eclipse.wst.common.component 480B
org.eclipse.wst.jsdt.ui.superType.container 49B
cxf-2.6.3.jar 6.09MB
jaxb-xjc-2.2.5.jar 3.31MB
xalan-2.7.1.jar 3.03MB
xmlbeans-2.5.0.jar 2.6MB
h2-1.3.169.jar 1.3MB
opensaml-2.5.1-1.jar 1.29MB
ehcache-core-2.5.1.jar 1.17MB
jaxb-impl-2.2.5.jar 1.05MB
js-1.7R2.jar 851KB
msv-core-2011.1.jar 666KB
spring-context-3.0.7.RELEASE.jar 655KB
xmlsec-1.5.2.jar 605KB
xmltooling-1.3.2-1.jar 597KB
commons-collections-3.2.1.jar 562KB
openws-1.4.2-1.jar 552KB
spring-beans-3.0.7.RELEASE.jar 544KB
joda-time-1.6.2.jar 530KB
woodstox-core-asl-4.1.4.jar 468KB
velocity-1.7.jar 439KB
antlr-2.7.7.jar 435KB
saaj-impl-1.3.19.jar 418KB
wss4j-1.6.7.jar 410KB
spring-web-3.0.7.RELEASE.jar 389KB
spring-core-3.0.7.RELEASE.jar 375KB
spring-aop-3.0.7.RELEASE.jar 314KB
commons-lang3-3.0.1.jar 306KB
jetty-server-7.5.4.v20111024.jar 300KB
commons-httpclient.jar 298KB
FastInfoset-1.2.12.jar 287KB
commons-lang-2.6.jar 278KB
serializer-2.7.1.jar 272KB
cxf-services-wsn-api-2.6.3.jar 228KB
spring-tx-3.0.7.RELEASE.jar 227KB
commons-beanutils-1.8.3.jar 227KB
xsdlib-2010.1.jar 224KB
geronimo-javamail_1.4_spec-1.7.1.jar 218KB
jetty-util-7.5.4.v20111024.jar 211KB
isorelax-20030108.jar 188KB
spring-jms-3.0.7.RELEASE.jar 181KB
cxf-services-sts-core-2.6.3.jar 178KB
stax2-api-3.1.1.jar 178KB
spring-expression-3.0.7.RELEASE.jar 166KB
xmlschema-core-2.0.3.jar 159KB
json-lib-2.4-jdk15.jar 155KB
wsdl4j-1.6.2.jar 145KB
jetty-http-7.5.4.v20111024.jar 112KB
jaxb-api-2.2.6.jar 97KB
jetty-io-7.5.4.v20111024.jar 89KB
xml-resolver-1.2.jar 82KB
jetty-security-7.5.4.v20111024.jar 81KB
jettison-1.3.2.jar 76KB
neethi-3.0.2.jar 70KB
geronimo-servlet_2.5_spec-1.1.2.jar 70KB
commons-dbutils-1.5.jar 60KB
cxf-services-wsn-core-2.6.3.jar 59KB
commons-logging-1.1.1.jar 59KB
geronimo-jaxws_2.2_spec-1.1.jar 59KB
commons-codec-1.4.jar 57KB
spring-asm-3.0.7.RELEASE.jar 52KB
共 184 条
- 1
- 2
公众号【架构师也是人】
- 粉丝: 562
- 资源: 17
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 整卷预览.mhtml
- MySQL是一种广泛使用的开源关系型数据库管理系统,它提供了丰富的SQL语句用于数据库的创建、查询、更新和管理 以下是一些常见的
- MySQL是一种广泛使用的开源关系型数据库管理系统,它提供了丰富的SQL语句用于数据库的创建、查询、更新和管理 以下是一些常见
- MySQL是一种广泛使用的开源关系型数据库管理系统,它提供了丰富的SQL语句用于数据库的创建、查询、更新和管理 以下是一些常见的
- 基于Javascript的结婚请帖设计源码 - Invitation
- mysql语句大全及用法
- mysql语句大全及用法
- mysql语句大全及用法
- MySQL是一种广泛使用的开源关系型数据库管理系统
- MySQL是一种广泛使用的开源关系型数据库管理系统
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页