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