Hibernate version:
2.1
Mapping documents:
Code between sessionFactory.openSession() and session.close():
A a = new A();
SessionFactory sf = new Configuration().configure().buildSessionFactory();
Session s = sf.openSession();
s.lock(a,LockMode.NONE);
s.close();
Full stack trace of any exception that occurs:
net.sf.hibernate.HibernateException: cannot lock an unsaved transient instance: [model.A]
at net.sf.hibernate.impl.SessionImpl.lock(SessionImpl.java:1634)
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Hi,
We run against the following problem. We transfer domain pojo's between business and web layer in a multi-tier app. First thing we do when we receive the pojo's from the web is re-associating them with the Hibernate Session with a Session.lock(..., LockMode.NONE);
However, when one of the pojo's is a newly instantiated one we get this Exception.
Does anybody know how to handle this ??
thx,
Roger.
|