Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » persist a collection in order
persist a collection in order [message #758564] Wed, 23 November 2011 17:00
FiruzzZ Mising name is currently offline FiruzzZ Mising nameFriend
Messages: 19
Registered: October 2011
Junior Member
Alo..
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.
Exam:

order.getItemList().add(item1);
order.getItemList().add(item2);
order.getItemList().add(item3);
persist(order);

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

//on Order
@OneToMany(cascade = CascadeType.ALL, mappedBy = "order", fetch = FetchType.EAGER)
private List<Item> itemList;
Previous Topic:Re: How can I check PersistenceContexts for equality
Next Topic:persist a collection in order
Goto Forum:
  


Current Time: Thu Apr 18 01:48:18 GMT 2024

Powered by FUDForum. Page generated in 0.01784 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top