I'm using HQL query, pls see the below code.
Entity class:
@Entity
@Table(name = "COUNTRY")
public class Country implements Serializable{
private long countryCode;
private String countryName;
DAO:
public List<Country> getCountryList(){
List<Country> resultList = null;
System.out.println("in dao");
Query query = getSession().createQuery(" from country ctry ");
resultList = query.list();
return resultList;
}
app context.xml:
<beans:property name="annotatedClasses">
<beans:list>
<beans:value>com.test.in.ergy.entity.Country</beans:value>
</beans:list>
</beans:property>
What might be the problem
I changed my query from HQL to SQL and its working. The query goes below..
String queryString = " select ctry.COUNTRY_CODE, ctry.COUNTRY_NAME from METRICS.COUNTRY ctry ";
try {
SQLQuery query = getSession().createSQLQuery(queryString);
resultList = query.list();
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments