-->
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.  [ 2 posts ] 
Author Message
 Post subject: Does SessionFactory.close() release mappings?
PostPosted: Wed May 09, 2007 4:54 pm 
Newbie

Joined: Fri Jul 23, 2004 12:13 am
Posts: 7
Hibernate version:3.2

Name and version of the database you are using:HSQLDB 1.8


When I execute the following sequence...

//using "Transaction demarcation with plain JDBC"
config.setProperty("hibernate.current_session_context_class","thread");
config.setProperty("hibernate.transaction.factory_class","org.hibernate.transaction.JDBCTransactionFactory");

sf = config.buildSessionFactory();
sf.getCurrentSession().beginTransaction();
sf.getCurrentSession().rollback(); // session automatically closed
sf.close()

sf = config.buildSessionFactory();

The 2nd buildSessionFactory() throws a DuplicateMappingException.
Does the session factory close() not remove all the existing mapping as well?

Full stack trace of any exception that occurs:

org.hibernate.DuplicateMappingException: Duplicate class/entity mapping com.abc.Feature
at org.hibernate.cfg.Mappings.addClass(Mappings.java:118)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:769)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:498)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:277)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1210)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 10, 2007 5:12 pm 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
Notice the error comes from org.hibernate.cfg. The original Configuration isn't explicitly single-use. You're using AnnotationConfiguration which looks like it is behaving that way. You might have some luck creating a JIRA for this, though it is a pretty rare use case I believe.

-Chris

_________________
Chris Bredesen
Senior Software Maintenance Engineer, JBoss


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

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.