-->
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: Name Space collision in mapping file
PostPosted: Fri Nov 04, 2005 2:41 pm 
Newbie

Joined: Tue Oct 21, 2003 7:59 pm
Posts: 9
I have two Action persistent objects, in two different packages. When I run hbm2ddl or create a Hibernate SessionFactory I get the stack trace below, telling me I have a duplicate.

Hibernate 2 had a auto-import = false attribute which could be added to the mapping to avoid this problem. There appears to be no analogue in Hibernate 3. This, to me, seems to be ridiculous. The reason Java has packages is to partly to create name spaces and avoid naming conflicts. So, why doesn't Hibernate support that?

Hibernate version:
3.05
Mapping documents:
<mapping resource="com/lggi/sp/common/spatial/processing/Action.hbm.xml"/>
<mapping resource="org/jbpm/graph/def/Action.hbm.xml"/>
Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
Caused by: org.hibernate.MappingException: duplicate import: Action refers to both org.jbpm.graph.def.Action and com.lggi.sp.common.spatial.processing.Action (try using auto-import="false")
at org.hibernate.cfg.Mappings.addImport(Mappings.java:119)
at org.hibernate.cfg.HbmBinder.bindPersistentClassCommonValues(HbmBinder.java:614)
at org.hibernate.cfg.HbmBinder.bindClass(HbmBinder.java:529)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:282)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:155)
at org.hibernate.cfg.Configuration.add(Configuration.java:375)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:415)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:466)
... 31 more
Name and version of the database you are using:
Oracle 10G R2, although it does not get there
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 04, 2005 4:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
please go read the docs again, and this time use a computer to search for auto-import, anything else seems ridiculous ;)

_________________
Max
Don't forget to rate


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.