我使用 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 );
}
测试.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”文件中找到线索,但我失败了。