[hibernate-issues] [Hibernate-JIRA] Created: (HCANN-9) Unable to reference JPA entity beans in a different package

Krashan Brahmanjara (JIRA) noreply at atlassian.com
Tue Oct 13 04:15:41 EDT 2009


Unable to reference JPA entity beans in a different package
-----------------------------------------------------------

                 Key: HCANN-9
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HCANN-9
             Project: Hibernate Commons Annotations
          Issue Type: Bug
         Environment: Hibernate Annotations 3.4.0.GA in Jboss 5.1.0.GA


            Reporter: Krashan Brahmanjara


Problem described in
https://forum.hibernate.org/viewtopic.php?f=1&t=998404 

Example
Two classes test.jpa.db1.Card ant test.jpa.db2.Cards are in different packages in the same jar and @ManyToOne fails if deployed on Jboss server
... but it work if these clases are together in the same package.
... it not fails on Weblogic with OpenJpa

Stack trace
09:53:37,609 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=test-services-ear
.ear/test-services-ejb-3.0.alfa-SNAPSHOT.jar#test-services-jpa state=Create
org.hibernate.AnnotationException: @OneToOne or @ManyToOne on test.jpa.db1.Card.podm references an unknown ent
ity: test.jpa.db2.Cards
        at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:81)
        at org.hibernate.cfg.AnnotationConfiguration.processEndOfQueue(AnnotationConfiguration.java:456)
        at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:438)
        at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:309)
        at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1148)
        at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1226)
        at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:173)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:854)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:425)
        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:131)
        at org.jbtest.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:301)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.jbtest.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
        at org.jbtest.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)

Tested workarounds, both doesn't work:
- adding an orm.xml file with entries like:
 <entity>test.jpa.db1.Card</entity>
 <entity>test.jpa.db2.Cards</entity>
- adding an hibernate extensions to class definition like:
  @Entity
  @org.hibernate.annotations.Entity
  @Table(name = "card")
    public class Card implements Serializable {





-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list