-->
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: same class name in different packages
PostPosted: Fri Nov 21, 2003 5:40 pm 
Newbie

Joined: Fri Nov 21, 2003 5:17 pm
Posts: 9
Location: Oklahoma City, OK, USA
In post http://forum.hibernate.org/viewtopic.php?t=468, Andrew_SER asked how to centralize his configuration files because he thought that adding 2 classes manually was what was causing his the error "net.sf.hibernate.MappingException: duplicate import" and Gavin told him to read up on imports. (though manually adding them isn't the real cause)

Well, I have 2 classes named the same in different packages and have their mappings imported into hibernate.cfg.xml. I get the "duplicate import" error. Is there any work around besides creating multiple configurations and session factories? It appears to me that this might be the only solution since net.sf.hibernate.cfg.Binder::bindClass adds the import to the mapping with an unqualified class name.

Here's my import statements:
<mapping resource="com/aaaa/objectmodel/Order.hbm.xml"/>
<mapping resource="com/aaaa/bbbb/objectmodel/Order.hbm.xml"/>

I'm using Hibernate 2.0.3.

Is there any (other) way to pull this off?

Thanks,
Cary


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 5:47 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
<hibernate-mapping auto-import="false">

you can then define whatever name you like for them using an explicit <import> tag.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 6:12 pm 
Newbie

Joined: Fri Nov 21, 2003 5:17 pm
Posts: 9
Location: Oklahoma City, OK, USA
doh! that was easy. Sorry I didn't notice that in the doc! I promise, I've been over it in the past :-)


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.