我正在使用HQL查詢,請參閱下面的代碼。查詢語法異常,表名未映射
實體類:
@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;
}
應用程序的context.xml:
<beans:property name="annotatedClasses">
<beans:list>
<beans:value>com.test.in.ergy.entity.Country</beans:value>
</beans:list>
</beans:property>
可能是什麼問題
但我試過使用COUNTRY,存在同樣的問題。 – madhu
測試國家 – esmoreno
我的查詢是使用國家作爲我給的類名是國家。不知道發生了什麼事情。無法解決問題 – madhu