Mapping an object in Hibernate that has 2 lists causing problems
Question
I'm trying to save an object that has 2 similar lists using a hbm.xml file. Below is my model object and HBM:
public class MyClass {
...
private List<MyType> list;
private List<MyType> otherList;
...
}
My HMB for this section is as follows:
<list name="list" cascade="all-delete-orphan"
lazy="false">
<key column="USER_ID" />
<list-index column="index" />
<one-to-many class="path.to.MyType" />
</list>
<list name="otherList" cascade="all-delete-orphan"
lazy="false">
<key column="USER_ID" />
<list-index column="index" />
<one-to-many class="path.to.MyType" />
</list>
However, when this object gets populated from the database, whatever I expect to be in 'list' is also showing up in 'otherList'. I imagine I'm missing a simple configuration change to allow hibernate to store these 2 lists properly, but I can't figure it out.
Any help?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow