[jboss-jira] [JBoss JIRA] Commented: (AS7-1234) Hibernate does not read/use metadata for orm.xml defined entites
Tomaz Cerar (JIRA)
jira-events at lists.jboss.org
Mon Jul 11 04:44:23 EDT 2011
[ https://issues.jboss.org/browse/AS7-1234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12613390#comment-12613390 ]
Tomaz Cerar commented on AS7-1234:
----------------------------------
Stuart/Jaikiran tnx for info, I have done all you said it is needed
-added jandex.idx in META-INF
-in manifest.mf referenced my module with annotations
I can see that app server loads the index (it complains if I rename file) but hibernate still dies with same exception.
I am creating a simple test case that I will attach (sorry I don't know how to register as module via ARQ)
when trace logging is enabled this is what I get just before it dies:
{noformat}
10:42:08,869 DEBUG [org.hibernate.cfg.Configuration] (MSC service thread 1-9) Process annotated classes
10:42:08,873 DEBUG [org.hibernate.cfg.AnnotationBinder] (MSC service thread 1-9) Binding entity from annotated class: com.parsek.cms.Article
10:42:08,892 DEBUG [org.hibernate.cfg.Ejb3Column] (MSC service thread 1-9) Binding column: Ejb3DiscriminatorColumn{logicalColumnName'DTYPE', discriminatorTypeName='string'}
10:42:08,899 DEBUG [org.hibernate.cfg.annotations.EntityBinder] (MSC service thread 1-9) Import with entity name Article
10:42:08,904 DEBUG [org.hibernate.cfg.annotations.EntityBinder] (MSC service thread 1-9) Bind entity com.parsek.cms.Article on table Article
10:42:08,925 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-9) MSC00001: Failed to start service jboss.persistenceunit."ppay-web.war#ppay-web": org.jboss.msc.service.StartException in service jboss.persistenceunit."ppay-web.war#ppay-web": F
ailed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1786)
at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: ppay-web] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:903)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:879)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.jboss.as.jpa.service.PersistenceUnitService.createContainerEntityManagerFactory(PersistenceUnitService.java:170)
at org.jboss.as.jpa.service.PersistenceUnitService.start(PersistenceUnitService.java:80)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
... 4 more
Caused by: org.hibernate.AnnotationException: No identifier specified for entity: com.parsek.cms.Article
at org.hibernate.cfg.InheritanceState.determineDefaultAccessType(InheritanceState.java:266)
at org.hibernate.cfg.InheritanceState.getElementsToProcess(InheritanceState.java:221)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:661)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3381)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3335)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1319)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1709)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:76)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:894)
... 9 more
{noformat}
> Hibernate does not read/use metadata for orm.xml defined entites
> ----------------------------------------------------------------
>
> Key: AS7-1234
> URL: https://issues.jboss.org/browse/AS7-1234
> Project: Application Server 7
> Issue Type: Bug
> Components: JPA / Hibernate
> Affects Versions: 7.0.0.Beta3, 7.0.0.CR1, 7.0.0.Final, 7.0.1.Final, 7.1.0.Alpha1
> Environment: windows 7, sql server 2008 r2
> Reporter: Tomaz Cerar
> Assignee: Scott Marlow
>
> I have setup where we have "common" entities defined in global lib/module that application(war/ear) in then dependent on.
> Then I declare this entities in orm.xml of my application just by class name.
> for instance:
> {code:xml}
> <entity class="com.company.module.Article"/>
> <entity class="com.company.module.Binary"/>
> <entity class="com.company.module.Category"/>
> {code}
> Up until as7/hibernate 4 this worked with no problems, but now it dies with exception "no id defined on entity Article". If I defined id in orm.xml it then finds id field but fails to find anything that is annotated on classes.
> It looks like metadata is not read for this classes and hibernate sees them as just plain pojo with no annotations.
> I am guessing that problem has to do something with integration with AS7 that now has jandex index for all annotations...
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list