-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hbm2ddlAuto drops/creates tables for ALL Hibernate MBeans
PostPosted: Wed Apr 13, 2005 4:50 pm 
Newbie

Joined: Thu Mar 24, 2005 6:24 pm
Posts: 8
Hibernate version: 2.1.8

Jboss version: 3.2.6

I'm deploying multiple Hibernate MBeans in a single hibernate-service.xml file. In line w/ that I have multiple mapping files in the HAR as well, so there is a 1:1 relationship between Hibernate MBean and mapping file, they're just all in the same HAR. The MBeans start up fine, and I can get at the SessionFactory objects, no problem.

The problem is that I'm using the Hbm2ddlAuto flag. So for each Hibernate MBean that starts up, it drops/create the tables for ALL of the Hibernate MBeans. The problem is that in the mean time, another custom MBean that depends on the Hibernate MBean has started up and put data in one of the tables - which promptly gets blown away when the second Hibernate MBean starts up and drops all of the tables.

It seems like the drop/create should be limited to the the tables being associated by the Hibernate MBean that has the Hbm2ddlAuto flag set.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 13, 2005 11:39 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Quote:
It seems like the drop/create should be limited to the the tables being associated by the Hibernate MBean that has the Hbm2ddlAuto flag set.

And which would those be? With HAR deployments you aren't explicitly telling the SessionFacctory which mapping files belong to it; instead the SessionFactory is discovering that for itself from the HAR.

What you are trying *will not* work. In fact, after reading this, I am going to add code to explicitly disallow multiple org.jboss.hibernate.jmx.Hibernate definitions within a single HAR/hibernate-service.xml

These should be two seperate HARs. If you want them to share some resources, bundle them into a SAR.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 14, 2005 9:16 am 
Newbie

Joined: Thu Mar 24, 2005 6:24 pm
Posts: 8
Fair enough. A documentation note to this effect would also be helpful, especially considering this is a different paradigm than using the net.sf.hibernate.jmx.HibernateService MBean. The HibernateService MBean allows multiple instances in a service file no problem (but has fewer features). I imagine this would be a somewhat common migration path (was for me).


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.