String gSql = "select sYear from VIEW_REPORT_BillingRegion group by sYear";
// Query query = sessionFactory.getCurrentSession().createQuery(gSql);
SQLQuery query = this.sessionFactory.getCurrentSession().createSQLQuery(gSql).addScalar("sYear", Hibernate.STRING);
List[Object] list = query.list();
System.out.println("======="+list.size());
for( Object objArr : list){
System.out.println(objArr );
}
System.out.println("============"+list.size());
Thursday, 9 April 2009
Wednesday, 8 April 2009
[Hibernate] native SQL example
@SuppressWarnings("unchecked")
@Transactional
public void getTest(IUiListCfg uiListCfg) throws ReportException {
try {
String sSql = "select sGroupId, sGroupName from tRmCo_Group";
SQLQuery query = this.sessionFactory.getCurrentSession().createSQLQuery(sSql).addScalar("sGroupId", Hibernate.STRING).addScalar("sGroupName", Hibernate.STRING);
List
@Transactional
public void getTest(IUiListCfg uiListCfg) throws ReportException {
try {
String sSql = "select sGroupId, sGroupName from tRmCo_Group";
SQLQuery query = this.sessionFactory.getCurrentSession().createSQLQuery(sSql).addScalar("sGroupId", Hibernate.STRING).addScalar("sGroupName", Hibernate.STRING);
List
Subscribe to:
Posts (Atom)