0
我想打一個getValueByLabel
方法的簡單查詢:休眠 - 我的表沒有映射
這裏是我的代碼:
public Config getValueByLabel(String label) throws EntityPersistException{
try {
Query query = em.createQuery("select id from config where config_label=:label",Long.class);
query.setParameter("label", label);
List<Long> config = query.getResultList();
return em.getReference(Config.class, config.get(0));
}
...
當我要開始我得到的方法:
org.hibernate.hql.internal.ast.QuerySyntaxException: config is not mapped [select id from config where config_label=:label]
任何想法如何解決這個問題?
UPDATE
我使用:
休眠4.0.1.Final 和一個PostgreSQL數據庫1.16.1