3
我不知道为什么我得到QuerySyntaxException: [Entity] is not mapped
,虽然Hibernate是为了记录什么可能导致QuerySyntaxException:[实体]未映射,虽然实体已被绑定?
INFO Hibernate EntityManager 3.5.0-Final
...
INFO Binding entity from annotated class: products.model.ProductGroup
INFO Bind entity products.model.ProductGroup on table GRP
...
INFO table found: GRP
INFO columns: [grp, name, top]
实体类看起来像
@Entity(name="GRP")
public class ProductGroup implements IdentifiableEntity {
@Id
private String grp;
private String name;
private String top;
...
}
错误是在这行抛出:
Query q = em.createQuery("select g from ProductGroup g");
这是所有JPA,没有Hibernate API。
解决了它。谢谢!但是,出现错误消息和日志记录有点误导,不是吗? – Zeemee 2012-08-14 13:05:41
在我看来,这个异常有点泛泛,但我可以理解他们为什么不想为每个案例映射一条错误消息。这是一个陷阱,但他们的确可以表明你的配置不正确。 – 2012-08-14 13:12:22