Tuesday, 29 May
2007
Tue, 29 May
'07
5:41 p.m.
I have the next exception:
org.hibernate.NonUniqueObjectException: a different object with the same
identifier value was already associated with the session
I work with tomcat 5 and hibernate 3.2
I have a ThreadLocal<Session> threadLocal where put the session and get
it, but each called to tomcat open new session of hibernate...
because the session in threadLocal is null
private static Session getSession() throws HibernateException {
Session session = threadLocal.get();
if (session == null || !session.isOpen()) {
if (sessionFactory == null) {
rebuildSessionFactory();
}
session = (sessionFactory != null) ?
sessionFactory.openSession() : null;
threadLocal.set(session);
}
return session;
}
any idea ? what happen this?
Thank you very much.
--
*Heber Lazcano*
*/Daemons Developer/*/ /
*Tralix - Everything happens on email.*
/Office: +52 (442) 2620304/
/Mobile: +52 (442) 1569756/
*/heber(a)tralix.com <mailto:heber@tralix.com>/*