I have this code I am persisting like that:
for (int i = 0; i < listofplusieurdrapage.size(); i++) {
persist(listofplusieurdrapage.get(i));
}
I have two values in
litsofplusieurdrapage => litsofplusieurdrapage.get(0) = 1
=>litsofplusieurdrapage.get(1) = 2
but when i check the database I found them in this order:
- 2
- 1
and when I add just a system.out.println
to the code I have the good order
for (int i = 0; i < listofplusieurdrapage.size(); i++) {
System.out.println(" Persist : " + listofplusieurdrapage.get(i));
persist(listofplusieurdrapage.get(i));
}
- 1
- 2
do you have an explication of the problem ?
and how I can keep the good order with out adding the system.out.println
to my code ?
public void persist(Object object) {
em.persist(object);
}