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:
|