JOIN US框架-3(hibernate怎么变成这么好用了?)
2015-05-29 09:50
399 查看
JOIN US框架中,hibernate变成这样了,哦,可恶的hql和实体类我们不用了,我们的机制是最后都是通过sql走的,效率取决于你的sql的效率,和ibatis的半自动有点像了,所有的表都在这里,pojo类也是用myeclipse自动生成的,无hibernate xml映射文件了,你见过吗?
这里笔者只截几个图示范
1:单表插入
2:单表修改
3:多表查询
4:多表编辑事务提交(事务提交的一种方式)
/**
* 添加卖家
*
* @param tSellerbasicinfo
* 卖家基本信息
* @param tSellerdetailinfo
* 卖家详细信息
* @return 添加结果
*/
public boolean insertSeller(TSellerbasicinfo tSellerbasicinfo,
TSellerdetailinfo tSellerdetailinfo,
TSellersysrolerelation tSellersysrolerelation) {
// ISQLModel list
ArrayList<ISQLModel> list = new ArrayList<ISQLModel>();
// 设置参数
// 卖家基本信息
tSellerbasicinfo.setId(UUIDUtil.getUUID()); // uuid
tSellerbasicinfo.setSellerPassword(securityUtil
.generateSellerDefaultPwd()); // 默认登陆密码
tSellerbasicinfo.setSellerRegisterTime(timeUtil.getCurrTimeBySeconds()); // 注册时间
tSellerbasicinfo.setDeleteFlag((short) 0); // 删除标记
// 卖家详细信息
tSellerdetailinfo.setId(tSellerbasicinfo.getId()); // 用户ID
tSellerdetailinfo.setDeleteFlag((short) 0);// 删除标记
// 卖家系统角色关系
tSellersysrolerelation.setId(UUIDUtil.getUUID()); // uuid
tSellersysrolerelation.setSellerId(tSellerbasicinfo.getId()); // 用户id
tSellersysrolerelation.setDeleteFlag((short) 0);// 删除标记
// 账户信息表
TAccount tAccount = new TAccount();// 账户信息表
tAccount.setId(UUIDUtil.getUUID()); // uuid
tAccount.setAccountNum(dataTableUtil.getTableGenerateSwiftNum()); // 账户流水号
tAccount.setAccountBalance(0d); // 账户余额
tAccount.setUserType(ServerUserTypeEnum.userType_2.getCode()); // 用户类型-卖家
tAccount.setUserId(tSellerbasicinfo.getId()); // 用户ID
tAccount.setDeleteFlag((short) 0);// 删除标记
// IDAO对象
IInsertSQLModel tSellerbasicinfoModel = new IInsertSQLModel(
BITableEnum.t_sellerbasicinfo.getTableName(),
beanMapUtil.objToHashMap(tSellerbasicinfo)); // 卖家基本信息
IInsertSQLModel tSellerdetailinfoModel = new IInsertSQLModel(
BITableEnum.t_sellerdetailinfo.getTableName(),
beanMapUtil.objToHashMap(tSellerdetailinfo)); // 卖家详细信息
IInsertSQLModel tSellersysrolerelationModel = new IInsertSQLModel(
BITableEnum.t_sellersysrolerelation.getTableName(),
beanMapUtil.objToHashMap(tSellersysrolerelation)); // 卖家系统角色关系
IInsertSQLModel tAccountModel = new IInsertSQLModel(
BITableEnum.t_account.getTableName(),
beanMapUtil.objToHashMap(tAccount)); // 账户信息
// IDAO对象添加到list
list.add(tSellerbasicinfoModel);
list.add(tSellerdetailinfoModel);
list.add(tSellersysrolerelationModel);
list.add(tAccountModel);
// 数据库操作
return sIDAO.iUpdateListBySQL(list, true);
}
5:查询数量
这里笔者只截几个图示范
1:单表插入
2:单表修改
3:多表查询
4:多表编辑事务提交(事务提交的一种方式)
/**
* 添加卖家
*
* @param tSellerbasicinfo
* 卖家基本信息
* @param tSellerdetailinfo
* 卖家详细信息
* @return 添加结果
*/
public boolean insertSeller(TSellerbasicinfo tSellerbasicinfo,
TSellerdetailinfo tSellerdetailinfo,
TSellersysrolerelation tSellersysrolerelation) {
// ISQLModel list
ArrayList<ISQLModel> list = new ArrayList<ISQLModel>();
// 设置参数
// 卖家基本信息
tSellerbasicinfo.setId(UUIDUtil.getUUID()); // uuid
tSellerbasicinfo.setSellerPassword(securityUtil
.generateSellerDefaultPwd()); // 默认登陆密码
tSellerbasicinfo.setSellerRegisterTime(timeUtil.getCurrTimeBySeconds()); // 注册时间
tSellerbasicinfo.setDeleteFlag((short) 0); // 删除标记
// 卖家详细信息
tSellerdetailinfo.setId(tSellerbasicinfo.getId()); // 用户ID
tSellerdetailinfo.setDeleteFlag((short) 0);// 删除标记
// 卖家系统角色关系
tSellersysrolerelation.setId(UUIDUtil.getUUID()); // uuid
tSellersysrolerelation.setSellerId(tSellerbasicinfo.getId()); // 用户id
tSellersysrolerelation.setDeleteFlag((short) 0);// 删除标记
// 账户信息表
TAccount tAccount = new TAccount();// 账户信息表
tAccount.setId(UUIDUtil.getUUID()); // uuid
tAccount.setAccountNum(dataTableUtil.getTableGenerateSwiftNum()); // 账户流水号
tAccount.setAccountBalance(0d); // 账户余额
tAccount.setUserType(ServerUserTypeEnum.userType_2.getCode()); // 用户类型-卖家
tAccount.setUserId(tSellerbasicinfo.getId()); // 用户ID
tAccount.setDeleteFlag((short) 0);// 删除标记
// IDAO对象
IInsertSQLModel tSellerbasicinfoModel = new IInsertSQLModel(
BITableEnum.t_sellerbasicinfo.getTableName(),
beanMapUtil.objToHashMap(tSellerbasicinfo)); // 卖家基本信息
IInsertSQLModel tSellerdetailinfoModel = new IInsertSQLModel(
BITableEnum.t_sellerdetailinfo.getTableName(),
beanMapUtil.objToHashMap(tSellerdetailinfo)); // 卖家详细信息
IInsertSQLModel tSellersysrolerelationModel = new IInsertSQLModel(
BITableEnum.t_sellersysrolerelation.getTableName(),
beanMapUtil.objToHashMap(tSellersysrolerelation)); // 卖家系统角色关系
IInsertSQLModel tAccountModel = new IInsertSQLModel(
BITableEnum.t_account.getTableName(),
beanMapUtil.objToHashMap(tAccount)); // 账户信息
// IDAO对象添加到list
list.add(tSellerbasicinfoModel);
list.add(tSellerdetailinfoModel);
list.add(tSellersysrolerelationModel);
list.add(tAccountModel);
// 数据库操作
return sIDAO.iUpdateListBySQL(list, true);
}
5:查询数量
相关文章推荐
- 使用nginx进行负载均衡
- JQ分页功能
- .NET 4.0下使用 SignalR
- 网络连接
- 【sql调优之执行计划】nested loops join and nested loop join outer
- MongoDB安全配置详解
- 微信运营:必须收藏的101条万能微信标题公式
- HDU 2065 "红色病毒"问题 指数生成函数
- 类似iOS自带相册应用的图片浏览的实现
- Qt环境配置
- Hibernate jar包详解
- GPU上缘何没有大量的cache
- 教程:VS2010 之TFS入门指南
- spring静态注入
- IE6下Png透明最佳解决方案DD_belatedPNG
- Hibernate之配置文件
- 支付宝demo 报错No architectures to compile for
- C++ string类型和char类型转换
- android ids.xml资源的使用
- 条款20:以const-reference传递替换by-value传递