1

I use hbm2java plugin in Eclipse to generate the entity classes. The tool decides to use Set and HashSet for relationships between tables. What I want is to use List and ArrayList() instead. How easy to do that?

zoro74
  • 171
  • 15
  • If you want a list returned in a hibernate one to many you need specify an element to hold the index. (otherwise there is no way for the order be persisted). – user3360944 Sep 15 '14 at 21:12
  • Thanks mate, can you elaborate more on "element to hold the index"? is that something in the DB to setup? I am using SQL Server and the reference columns are indexed already. – zoro74 Sep 16 '14 at 05:12
  • This is something you set up in the mapping. If you use annotations it looks something like this: @Entity public class Parent { @OneToMany(mappedBy="parent") @OrderColumn(name="order") private List children; } – user3360944 Sep 16 '14 at 13:35

0 Answers0