私はいくつかのエンティティを設定しました。
@Entity
@Table
public class Question implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String question;
@OneToMany(mappedBy = "question", fetch = FetchType.EAGER)
private List<Answer> answers = new ArrayList<>();
//getter, setter, custom methods
}
components.xml :
[...]
<persistence:hibernate-session-factory name="sessionFactory"/>
<persistence:managed-hibernate-session name="session"
session-factory="#{sessionFactory}"/>
[...]
persistence.xml :
<?xml version="1.0" encoding="UTF-8"?>
<!-- Persistence deployment descriptor for dev profile -->
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="seam_helloworld" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/firstjsf</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="jboss.entity.manager.factory.jndi.name" value="java:/seam_helloworldEntityManagerFactory"/>
<property name="hibernate.connection.useUnicode" value="true"/>
<property name="hibernate.connection.characterEncoding" value="UTF-8"/>
<property name="jboss.as.jpa.providerModule" value="org.hibernate:3"/>
</properties>
</persistence-unit>
</persistence>
sessionFactory.getAllClassMetadata() を呼び出すと、サイズがゼロのマップだけが取得されます。同様に、sessionFactory.getClassMetadata(Question.class) は null を返します。
この問題を解決するにはどうすればよいですか? Hibernate 3.6、Seam 2.3、JBoss AS 7.1.1 を使用しています