Hi,
I have a trouble with the session.save..
I have a list of object Flight and each Flight have a list of FlightSegment.
The joke is, if i break my "loop for" at the first run, i refind my Flight and his 2 FlightSegment properly register in the database.
If i i dont break i have the 3 Flight (of Flist) but i miss the second FlightSegment of he first Flight...
And the print show me properly all the FlightSegment , in all the case.
The "for each" going too fast for hibernate insert ? Like the instance of v from the first turn of loop erase the v instance of the next turn ????
Code:
for(Flight v : Flist){
tx = session.beginTransaction();
for (FlightSegment fg : v.getListFlightSegment()){
System.out.println(fg.getStartAirp()+"-"+fg.getEndAirp()+"-"+fg.getFltNum());
}
v.setType(i);
Date Dnnow = new Date();
v.setTmstamp(Dnnow.getTime());
session.save(v);
tx.commit();
i++;
//break;
}
Thanks for your help