-->
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: Mapping 2 tables with same name from different schemas
PostPosted: Tue Mar 08, 2005 2:33 pm 
Newbie

Joined: Tue Mar 08, 2005 2:08 pm
Posts: 5
I a table X in schema A, and another table named X in schema B. While the two tables have the same name they are completely unrelated. I have to write an application that interacts with both tables.

I have 2 hibernate mapping files set up as follows:
src/com/me/db/A/X/X.hbm.xml:
<hibernate-mapping package="com.me.db.A.X" schema="A">
<class name="X" table="X">
...
</class>
</hibernate-mapping>

src/com/me/db/b/X/X.hbm.xml:
<hibernate-mapping package="com.me.db.B.X" schema="B">
<class name="X" table="X">
...
</class>
</hibernate-mapping>

Now when I try to load the hibernate configuration I get this error message:
net.sf.hibernate.MappingException: duplicate import: X

Hibernate 2.1.7c

Any suggestions??


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 08, 2005 5:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Disable auto-import of the classnames:
Code:
<hibernate-mapping
        package="com.me.db.A.X"
        schema="A"
        auto-import="false">
   ...
</hibernate-mapping>


You can even give them explicit import names:
Code:
<hibernate-mapping
        package="com.me.db.A.X"
        schema="A"
        auto-import="false">
    <import class="X" rename="AX"/>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 09, 2005 12:00 pm 
Newbie

Joined: Tue Mar 08, 2005 2:08 pm
Posts: 5
Thanks, that worked perfectly.


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.