-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Problems with evict() and clear()
PostPosted: Wed Jul 06, 2005 1:30 am 
Newbie

Joined: Thu Dec 23, 2004 7:26 pm
Posts: 11
Hi,



I'm having difficulty after migrating from 2.1.6 to 3.0.5. I have an application that uses two different sessions. Not that it matters, but here's the reason I have implemented it this way. I have an application that must store three different versions of the same data in different tables. One table, for instance, is named PRODUCT. This is the table end users interact with when submitting data about a product. When the product is submitted in the workflow engine, it gets copied to a table named PRODUCT_REVIEW. Once the product is reviewed and approved, it moved to PRODUCT_PRODUCTION. Because these three tables have identical table structure (and a number of associated tables with the same naming pattern), I have been using NamingStrategy to alter the actual table the data is persisted to without having to map out the identical tables.

Anyhow, I'm sure somebody might take offense at my usage of NamingStrategy, but that's somewhat beside the point. My issue is that, since the upgrade, I receive HibernateException when I try to associate an object with a new session, even after I've called evict(object) or clear():
Code:
            HibernateSessionFactory.currentSession().evict(c);
            HibernateSessionFactory.currentSession().clear();
            Session session = HibernateSessionFactoryReview.currentSession();
            Transaction tx = session.beginTransaction();
            session.replicate(c, ReplicationMode.OVERWRITE);
            tx.commit();
            session.close();


Code:
junit.framework.AssertionFailedError: com.greenbuildingpages.util.GBPException: org.hibernate.HibernateException: illegally attempted to associate a proxy with two open Sessions
   ...

Is this the way I should expect Hibernate to respond in 3.0, or is this a bug that is being addressed?

Thanks!

_________________
Todd Farmer


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.