Community

Stateful beans from 2 Jars - 1 persistence unit

created by Nick Dodd in EJB 3.0 Development - View the full discussion

I have a persistence unit named FOO inside a jar file as follows:

 

 

<persistence-unit name="FOO">
     <provider>org.hibernate.ejb.HibernatePersistence</provider>
     <jta-data-source>java:/MYDS</jta-data-source>
     <properties>
          <property name="hibernate.hbm2ddl.auto" value="update"/>
     </properties>
     <jar-file>file:../anotherDir/secondary.jar</jar-file>
</persistence-unit>

 

This jar contains several Entity Beans and Session Beans that use this persistence unit ok.

 

As you can see I also have a second jar referenced in the persistence unit, it is another jar (not within an ear) that contains 1 more Entity bean and also 1 Session Bean.

 

When I start the server all tables are successfully created including the entity defined in the secondary jar.

 

However - the Session Bean in the secondary jar is causing problems.

 

public class SecondaryFacade implements SecondaryFacadeLocal, SecondaryFacadeRemote {
 
......
 
   @PersistenceContext(unitName="FOO")
    protected EntityManager em;
 
......

 

ObjectName: persistence.units:unitName=FOO

  State: NOTYETINSTALLED

  Depends On Me:

    jboss.j2ee:service=EJB3,jar=secondary.jar,name= SecondaryFacade

 

This issue may be related but not sure:

 

http://community.jboss.org/message/344723#344723

 

Am running JBoss 4.3.0. What I am doing might not even be possible or legal but if so then why does it deploy the Entity Bean successfully but not the Session Bean?

 

Many thanks

Reply to this message by going to Community

Start a new discussion in EJB 3.0 Development at Community