|persist a collection in order [message #758564]
||Wed, 23 November 2011 12:00
| FiruzzZ Mising name
Registered: October 2011
the issue is that when I persist a Order with a of List<Item> (OneToMany), Item's are persisten randomly without respect the order of the List.
When I retrieve (or check directly on the DB) the entity and check the detail, they are disordered.
Sometimes persist first item1, sometimes item2 and so on..
The only way i found to avoid this behavior was persist the Order with a empty collection and then one by one the collections of Item's.
here is fragment of the mapping
@OneToMany(cascade = CascadeType.ALL, mappedBy = "order", fetch = FetchType.EAGER)
private List<Item> itemList;
Powered by FUDForum
. Page generated in 0.01639 seconds