Community
Participate
Working Groups
Build Identifier: 1.1.2.v201011151542 Using HbEntityDataStore instead of HbDataStore causes the following exception after Teneo uses Hibernate 3.6: Exception in thread "main" javax.persistence.PersistenceException: Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:911) at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.buildEntityManagerFactory(HbEntityDataStore.java:242) at org.eclipse.emf.teneo.hibernate.HbEntityDataStore.initialize(HbEntityDataStore.java:116) at org.eclipse.emf.teneo.hibernate.examples.QuickStart.doQuickStart(QuickStart.java:101) at org.eclipse.emf.teneo.hibernate.examples.QuickStart.main(QuickStart.java:49) Caused by: org.hibernate.MappingException: Unknown entity: org.eclipse.emf.teneo.hibernate.examples.extlibrary.impl.ItemImpl at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:691) at org.hibernate.ejb.metamodel.AttributeFactory.getDeclarerEntityMetamodel(AttributeFactory.java:242) at org.hibernate.ejb.metamodel.AttributeFactory.access$600(AttributeFactory.java:66) at org.hibernate.ejb.metamodel.AttributeFactory$4.resolveMember(AttributeFactory.java:955) at org.hibernate.ejb.metamodel.AttributeFactory.determineAttributeMetadata(AttributeFactory.java:444) at org.hibernate.ejb.metamodel.AttributeFactory.buildAttribute(AttributeFactory.java:93) at org.hibernate.ejb.metamodel.MetadataContext.wrapUp(MetadataContext.java:183) at org.hibernate.ejb.metamodel.MetamodelImpl.buildMetamodel(MetamodelImpl.java:66) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902) ... 4 more Reproducible: Always
Created attachment 183606 [details] Modified QuickStart.java Martin, It's actually pointless to attach a test model since the error occurs even with a small model having only one object with only an id attribute. So I modified the QuickStart.java from org.eclipse.emf.teneo.hibernate.examples. I only changed the following: // final HbDataStore hbds = HbHelper.INSTANCE // .createRegisterDataStore(hbName); HbEntityDataStore hbds = new HbEntityDataStore(); hbds.setName(hbName); I also had to add javax.persistence to the dependencies. Can you reproduce this? I'm using my own hibernate bundle. Need anything else?
It seems that there is a bug in the Hibernate entity meta model creation. This meta model is only needed for entity manager criteria queries and not even then. Hibernate offers a property to disable this meta model creation effectively working around this issue. I have now set this as the default behavior for the entity data store. To try it out yourselve you need to set the following property: hibernate.ejb.metamodel.generation to the value: disabled The default setting of this property will be in the next build.
Committed to cvs and new build published
Hi Martin Just tested with the new build. Works! Thanks a lot for the fix