[hibernate-announce] NonUniqueObjectException

Steve Ebersole steve at hibernate.org
Tue May 29 19:27:22 EDT 2007


Hmmm, this does not sound like a Hibernate announcement to me...


On Tue, 2007-05-29 at 17:41 -0500, Heber Lazcano wrote:
> 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 at tralix.com 
> 
> 
> _______________________________________________
> hibernate-announce mailing list
> hibernate-announce at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-announce




More information about the hibernate-announce mailing list