我有一bean
堂课,在Not mapped
to adatabase
table
中。我用过createSqlQuery
和addEntity
for mapping the result set
。但是error
是:unknown entity
。我使用setResultSetMapping
和error
is中已经引入unknown entity.
的类。bean
hibernate.cfg.xml
谢谢。
我有一bean
堂课,在Not mapped
to adatabase
table
中。我用过createSqlQuery
和addEntity
for mapping the result set
。但是error
是:unknown entity
。我使用setResultSetMapping
和error
is中已经引入unknown entity.
的类。bean
hibernate.cfg.xml
谢谢。
检查您的映射 - 您可能引用了未知类 (CodeTemplate)。
有两种解决方法
第一种方式:
您必须添加类,这使您@Entity
的Pojo
pojo 成为 JPA 实体。
二、使用配置:
您应该使用 AnnotationConfiguration 而不是 Configuration 然后调用
configuration.addAnnotatedClass(YourClass.class);
参考@Entity
Specifies that the class is an entity. This annotation is applied
to the entity class.