Here I'm back with the same question:
I have the following situation:
c1 has 2 children c2 and c3
c2 has also 2 children c4 and c5.
when I store c1 into the database, everything works fine.
when I load c1 back from the database, remove c4 and store
c1 into the database again, c4 is not removed from the database.
Hibernates does not reconize the changes made in the tree.
.......................................
.................c4...................
.............../.......................
.........c2--........................
....... / .....\......................
..c1--..........c5..................
........\ .............................
.........c3...........................
.......................................
How can I solve that problem?
For the connection to the database I use following code:
Code:
Session session = sessions.openSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
session.saveOrUpdate(comp);
tx.commit();
}
catch (HibernateException he) {
if (tx!=null) tx.rollback();
throw he;
}
finally {
session.close();
}
Because I use saveOrUpdate, you should think hibernate would update the database. Well, he doesn't.
Am I missing something. I did not paste any code because I think this is a very general question.
Is it a cache concern, or something else?
Thanks in advance,
Stijn.