【发布时间】:2011-02-17 10:47:09
【问题描述】:
我使用 Hibernate3 和 Hibernate Tools 3.2.4 来生成 hbm.xml 和 java 文件,我想使用 List 而不是 HashSet(...)。我试图修改 hbm.xml 文件,将列表而不是设置。有什么方法可以指定要自动生成列表而不是 HashSet 的休眠工具? 这是一个例子:
Java 类
public class Test implements java.io.Serializable {
private Long testId;
private Course course;
private String testName;
private Set<Question> questions = new HashSet<Question>( 0 );
}
Test.hbm.xml:
<set name="questions" inverse="true" lazy="true" table="questions" fetch="select">
<key>
<column name="test_id" not-null="true" />
</key>
<one-to-many class="com.app.objects.Question" />
...
</set>
本以为可以在“reveng.xml”文件中找到线索,但失败了。
【问题讨论】:
标签: hibernate orm settings reverse-engineering hbm