[Teneo] Duplicate entity name problem in hibernate mapping file. [message #603473] |
Mon, 12 March 2007 11:10 |
Duncan Alexander Messages: 90 Registered: July 2009 |
Member |
|
|
Hi there,
I am attempting to initialize an HBDataStore with an existing mapping file and am running into
problems with duplicate entity names from different EPackages. I have been through the newsgroups
and found this posting which described the use of QUALIFY_ENTITY_NAME persistence option to work
around the issue.
http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg01811.html
I therefore changed my code to the following :
// create the HbDataStore
HbDataStore hbds = HbHelper.INSTANCE.createRegisterDataStore(hbName);
Properties persistenceProperties = new Properties();
persistenceProperties.setProperty(PersistenceOptions.USE_MAP PING_FILE, "true");
persistenceProperties.setProperty(PersistenceOptions.QUALIFY _ENTITY_NAME,
PersistenceOptions.QUALIFY_ENTITY_NAME_NSPREFIX);
hbds.setPersistenceProperties(persistenceProperties);
// sets its epackages stored in this datastore
hbds.setEPackages(new EPackage[]{BasePackage.eINSTANCE,
CategorySchemePackage.eINSTANCE,
KeyFamilyPackage.eINSTANCE,
CodeListPackage.eINSTANCE,
ConceptSchemePackage.eINSTANCE,
ReferencePackage.eINSTANCE,
RegistryPackage.eINSTANCE,
LegacyPackage.eINSTANCE});
// set the relational database to use
hbds.setHibernateProperties(props);
// initialize the Datastore
hbds.initialize();
// Create a session and a transaction
org.hibernate.classic.Session session = hbds.getSessionFactory().openSession();
Transaction tx = session.getTransaction();
// start a transaction
tx.begin();
// Do persistence things etc etc etc.....
tx.commit();
// and close
session.close();
--------------------------------------------------------
However I still get a duplicate entity error as follows:
org.hibernate.DuplicateMappingException: Duplicate class/entity mapping Property
at org.hibernate.cfg.Mappings.addClass(Mappings.java:118)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:145)
at org.hibernate.cfg.Configuration.add(Configuration.java:669)
at org.hibernate.cfg.Configuration.addInputStream(Configuration .java:504)
at org.eclipse.emf.teneo.hibernate.HbDataStore.mapModel(HbDataS tore.java:363)
at org.eclipse.emf.teneo.hibernate.HbDataStore.initialize(HbDat aStore.java:156)
at .....etc etc etc
Is there another persistence option that needs to be set to provide around for duplicate entity names?
Any insights greatly appreciated.
Duncan
|
|
|
Powered by
FUDForum. Page generated in 0.03157 seconds