Joined: Thu Sep 02, 2004 8:16 am Posts: 4
|
As I am just expermenting with Hibernate I came to the following "weird" (forgive my ignorance) behaviour.
I am adding transient objects to a session without actually committing or rolling back a transaction. When closing the session, opening a new session and executing a find on this newly created session it returns me the non committed objects.
Any enlightment on this would be appreciated.
Kind regards
Hibernate version: 2.1.4 and 2.1.6
Mapping documents:
Code between sessionFactory.openSession() and session.close():
session = sessionFactory.openSession();
for (int i = 0; i < 10; i++) {
myClass = new MyClass("ricky");
session.saveOrUpdate(myClass );
session.evict(myClass );
}
session.clear();
session.flush();
session.close();
sessionFactory.evict(SystemEndpoint.class);
session = sessionFactory.openSession();
myClassList = session.find("from MyClass");
// returns the previously saved but non committed objects
for (Iterator iter = systemEndPointList.iterator(); iter.hasNext();) {
System.out.println(" --> " + iter.next());
}
session.close();
Name and version of the database you are using:
MySQL 4.0.20d
|
|