-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Deploying an EAR with multiple entity JARs
PostPosted: Fri Jan 05, 2007 6:00 pm 
Newbie

Joined: Fri Jan 05, 2007 4:36 pm
Posts: 3
I have an application that I am trying to deploy as an EAR.

In the EAR I have:

1) One WAR file
2) One app.jar EJB file
3) One framework.jar EJB file

I have included the persistence.xml file in the EAR's META-INF directory. The application.xml file has both app.jar and framework.jar defined as an ejb module.

In the app.jar file I have an entity that has a @OneToOne relationship with another entity in the framework.jar file.

In app.jar, the Foo class looks like:
Code:
package app.model;

import javax.persistence.*;
import framework.model.Bar;

public class Foo {
    @Id
    @GeneratedValue
    private Long id;

    @OneToOne
    @JoinColumn(name = "BARID")
    private Bar bar;

    public Foo() {
    }

    // getters and setters omitted
}


In framework.jar, I have:
Code:
package framework.model;

public class Bar {
    @Id
    @GeneratedValue
    @Column(name = "BARID")
    private Long id;

    // Getters and setters omitted
}


When I try to deploy this EAR, all the @Entities in app.jar are recognized and binded, but none of the @Entities in framework.jar get binded (and hence, not managed by the EntityManagerFactory).

The exception I get is:

Code:
org.hibernate.AnnotationException: @OneToOne or @ManyToOne on app.model.Foo.bar references an unknown entity: framework.model.Bar
        at org.hibernate.cfg.FkSecondPass.doSecondPass(FkSecondPass.java:56)
        at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:428)
        at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:286)
        at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1039)
        at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1207)
        at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:844)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:382)
        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
...


Does anyone have any ideas on what I would need to do to get this working?

Any advice would be greatly appreciated!

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.