Using HQL query
Query query = sessionFactory.
getCurrentSession(). createQuery("select custType.customerTypeId as customerTypeId, custType.customerTypeName as customerTypeName from CustomerType custType");
List<CustomerTypeData> customerTypeDataList = query.setResultTransformer( Transformers.aliasToBean(Custo merTypeData.class)).list();
List<CustomerTypeData> customerTypeDataList = sessionFactory. getCurrentSession()
.createCriteria(CustomerType. class)
.setProjection(
Projections.projectionList(). add(
Projections.property(" customerTypeId"),
"customerTypeId").add( Projections.property(" customerTypeName"),
"customerTypeName"))
.setResultTransformer(
Transformers.aliasToBean(Custo merTypeData.class)).list();
Query query = sessionFactory.
List<CustomerTypeData> customerTypeDataList = query.setResultTransformer(
Using Criteria
List<CustomerTypeData> customerTypeDataList = sessionFactory.
.createCriteria(CustomerType.
.setProjection(
Projections.projectionList().
Projections.property("
"customerTypeId").add(
"customerTypeName"))
.setResultTransformer(
Transformers.aliasToBean(Custo
No comments:
Post a Comment