-->
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: Referencing a class in a different mbean
PostPosted: Wed May 31, 2006 11:19 am 
Newbie

Joined: Wed May 24, 2006 10:11 am
Posts: 5
Hibernate version:
3.0

Good day to all,
I'm using Hibernate 3 with JBoss 4.0.3 SP1; I'm deploying using the .har archives, but I have a little problem.

I have 2 .har files which map different tables on the same database; however, the 2nd .har references, in a many-to-one relationship, a class of the 1st .har file.

While trying to load the 2nd .har, it gives a org.hibernate.MappingException: An association from table xxxx refers to an unmapped class yyyy

Mapping documents:
1st .har jboss-service.xml
Code:
<mbean code="org.jboss.hibernate.jmx.Hibernate"  name="jboss.har:service=tu-core">
    <attribute name="DatasourceName">java:/CacheDS</attribute>
    <attribute name="Dialect">com.tu.hibernate.CacheDialect</attribute>
    <attribute name="SessionFactoryName">java:/hibernate/SessionFactory/tu-core</attribute>
    <attribute name="CacheProviderClass">org.hibernate.cache.HashtableCacheProvider</attribute>
    <attribute name="ShowSqlEnabled">true</attribute>
</mbean>



2nd .har jboss-service.xml
Code:
<mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=tu-accessControl">
    <attribute name="DatasourceName">java:/CacheDS</attribute>
    <attribute name="Dialect">com.tu.hibernate.CacheDialect</attribute>
    <attribute name="SessionFactoryName">java:/hibernate/SessionFactory/tu-accessControl</attribute>
    <attribute name="CacheProviderClass">org.hibernate.cache.HashtableCacheProvider</attribute>
    <attribute name="ShowSqlEnabled">true</attribute>
</mbean>


Is there any workaround to this problem short of putting all the classes in the same .har file?
I'd really like to separate the logic between the persistence classes.

Best regards

domyalex


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 10:29 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
In whatever code loads your .cfg.xml files, you need to build a configuration from one .cfg.xml (you're already doing this), then call configure(otherFile) before you call buildSessionFactory. Once your Configuration object is aware of both sets of mappings, it can build the session factory just fine.

_________________
Code tags are your friend. Know them and use them.


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.