Hibernate 后台json封装 博客分类: Hibernate hibernate
程序员文章站
2024-03-26 11:54:11
...
public List<OrgVO> qryVO() {
String hql = "select new com.miniui.demo.vo.user.OrgVO(tbuo.TBasisOrg.orgId, tbuo.TBasisOrg.orgCode, tbuo.TBasisOrg.orgName, tbuo.TBasisOrg.orgDesc, tbuo.TBasisOrg.orgPid, tbuo.TBasisOrg.orgLevel, tbuo.TBasisOrg.isDisable, tbuo.TBasisOrg.orgAdd, tbuo.TBasisOrg.updateUser, tbuo.TBasisOrg.updateTime) from TBasisUserOrg tbuo";
List<OrgVO> orgVOs = this.getCurrentSession().createQuery(hql).list();
return orgVOs;
}
@SuppressWarnings({ "deprecation", "unchecked" })
@Override
public List<OrgVO> qryVO2() {
String sql = "SELECT ORG_PID AS orgPid,ORG_ID AS orgId, ORG_NAME AS orgName FROM T_BASIS_ORG";
Query sqlQuery = this.getCurrentSession().createSQLQuery(sql)
.addScalar("orgPid", Hibernate.STRING)
.addScalar("orgId", Hibernate.STRING)
.addScalar("orgName", Hibernate.STRING);
sqlQuery.setResultTransformer(Transformers.aliasToBean(OrgVO.class));
return sqlQuery.list();
}
@Override
public List<?> qryMap()
{
String hql = "select new map(e.busintypeid as id ,e.busintypename as name,e.busintypeid as num,e.businremark as desc,e.updatetime as time) from TBasisType e where 1=1";
Query hqlQuery = this.getCurrentSession().createQuery(hql);
List<?> list = hqlQuery.list();
return list;
}
@Override
public List<?> qryMap2() {
String sql = "SELECT BUSINTYPEID, BUSINTYPENAME, BUSINREMARK, STATUS, UPDATEUSER AS usr, UPDATETIME FROM T_BASIS_TYPE";
Query sqlQuery = this.getCurrentSession().createSQLQuery(sql);
sqlQuery.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
return sqlQuery.list();
}
String hql = "select new com.miniui.demo.vo.user.OrgVO(tbuo.TBasisOrg.orgId, tbuo.TBasisOrg.orgCode, tbuo.TBasisOrg.orgName, tbuo.TBasisOrg.orgDesc, tbuo.TBasisOrg.orgPid, tbuo.TBasisOrg.orgLevel, tbuo.TBasisOrg.isDisable, tbuo.TBasisOrg.orgAdd, tbuo.TBasisOrg.updateUser, tbuo.TBasisOrg.updateTime) from TBasisUserOrg tbuo";
List<OrgVO> orgVOs = this.getCurrentSession().createQuery(hql).list();
return orgVOs;
}
@SuppressWarnings({ "deprecation", "unchecked" })
@Override
public List<OrgVO> qryVO2() {
String sql = "SELECT ORG_PID AS orgPid,ORG_ID AS orgId, ORG_NAME AS orgName FROM T_BASIS_ORG";
Query sqlQuery = this.getCurrentSession().createSQLQuery(sql)
.addScalar("orgPid", Hibernate.STRING)
.addScalar("orgId", Hibernate.STRING)
.addScalar("orgName", Hibernate.STRING);
sqlQuery.setResultTransformer(Transformers.aliasToBean(OrgVO.class));
return sqlQuery.list();
}
@Override
public List<?> qryMap()
{
String hql = "select new map(e.busintypeid as id ,e.busintypename as name,e.busintypeid as num,e.businremark as desc,e.updatetime as time) from TBasisType e where 1=1";
Query hqlQuery = this.getCurrentSession().createQuery(hql);
List<?> list = hqlQuery.list();
return list;
}
@Override
public List<?> qryMap2() {
String sql = "SELECT BUSINTYPEID, BUSINTYPENAME, BUSINREMARK, STATUS, UPDATEUSER AS usr, UPDATETIME FROM T_BASIS_TYPE";
Query sqlQuery = this.getCurrentSession().createSQLQuery(sql);
sqlQuery.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
return sqlQuery.list();
}
推荐阅读
-
Hibernate 后台json封装 博客分类: Hibernate hibernate
-
Hibernate 后台json封装 博客分类: Hibernate hibernate
-
JDBC,Hibernate 分页怎样实现? 博客分类: web前端
-
过去的一个关于数据库设计的讨论,觉得有些价值,自己收藏起来 博客分类: PowerDesigner 数据结构Hibernate多线程电子商务单元测试
-
让OpenSessionInViewFilter更灵活的过滤URL 博客分类: Hibernate ServletJSPWebSpringHibernate
-
Hibernate在高并发的情况下的一个问题 博客分类: hibernate hibernate多线程
-
hibernate 使用 博客分类: hibernate hibernate使用
-
hibernate 报错 SQL Error: 1062, SQLState: 23000 博客分类: springhibernateexception hibernatespringspringbootjavaweb
-
SpringMVC_3.x_入门指南_4 博客分类: SpringMVC SpringMVC连接Hibernate框架整合
-
Spring+SpringMVC+Hibernate整合(封装CRUD操作) 博客分类: 框架整合 SpringSpringMVCHibernate框架整合CRUD