0

我有一bean堂课,在Not mapped to adatabase table中。我用过createSqlQueryaddEntityfor mapping the result set。但是error是:unknown entity。我使用setResultSetMappingerroris中已经引入unknown entity. 的类。beanhibernate.cfg.xml

谢谢。

4

2 回答 2

0

检查您的映射 - 您可能引用了未知类 (CodeTemplate)。

于 2013-02-11T07:29:08.950 回答
0

有两种解决方法

第一种方式:

您必须添加类,这使您@EntityPojopojo 成为 JPA 实体。

二、使用配置:

您应该使用 AnnotationConfiguration 而不是 Configuration 然后调用

 configuration.addAnnotatedClass(YourClass.class);

参考@Entity

    Specifies that the class is an entity. This annotation is applied 
    to the entity class. 
于 2013-02-11T09:02:59.973 回答