-->
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.  [ 6 posts ] 
Author Message
 Post subject: Deployment
PostPosted: Wed Sep 05, 2007 1:27 pm 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
posted Today 8:23 PM
--------------------------------------------------------------------------------
Hey,

I have ear that contain jar Model,Infra,Server.

I want to have persistence unit XXX that has all the entitis under Jars - Model,Infra

And persistence unit YYY that all the entitis under Jar - Server.

Server has DAO that need to work with the two persistence units.

Where should i put the META-INF files?

Is it ok to has entites in Jar that dosnt declared as ejb jar?

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 06, 2007 8:19 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you can do that by refering to an external jar using the <jar-file> (i believe) element of a persistence.xml

The jar containing the persistence.xml has to be an ejb-jar

_________________
Emmanuel


Top
 Profile  
 
 Post subject: The issue that i have is to reference to this persistence un
PostPosted: Fri Sep 07, 2007 7:04 am 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
Hey,

I success to include entites from another jar in the persistence , but the problem is that my DAO's from another jar cant reference to this persistence unit.


I get an exception in the deploy:
Code:
14:01:55,513 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:ear=insite-1.0-SNAPSHOT.ear,jar=serverInfrastructure-1.0-SNAPSHOT.jar,name=AuditorDao,service=EJB3
  State: NOTYETINSTALLED
  I Depend On:
    persistence.units:jar=ver-1.0-SNAPSHOT.jar,unitName=BRL-Server


The DAO in the other jar failed to find the persistence unit which declared in the "server-1.0-SNAPSHOT.jar".

Here is the injection:
@PersistenceContext(unitName="server-1.0-SNAPSHOT.jar#BRL-Server")
Code:


Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 07, 2007 10:54 am 
Senior
Senior

Joined: Tue Jul 25, 2006 9:05 am
Posts: 163
Location: Stuttgart/Karlsruhe, Germany
Hi,

Why don't you just define the Persistence.xml at the top level in the ear, then all "sub jars" should be able to use it.

You just need to pack a jar file in $EAR_ARCHIVE/lib, you will need a class to put in you jar file just with an empty constructor, and pack the Persistence.xml in the META-INF dir of the jar

Cheers,

Andy

_________________
Rules are only there to be broken


Top
 Profile  
 
 Post subject: I will try this
PostPosted: Sun Sep 09, 2007 2:50 am 
Regular
Regular

Joined: Wed May 02, 2007 2:42 pm
Posts: 101
What do you mean -
Quote:
you will need a class to put in you jar file just with an empty constructor


Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 09, 2007 3:06 am 
Senior
Senior

Joined: Tue Jul 25, 2006 9:05 am
Posts: 163
Location: Stuttgart/Karlsruhe, Germany
Hi,

Thinking about maybe you won't, but i meant just some simple class like below:

Code:
public class foobar {
   public foobar() {
      super();
   }
}


but maybe it will work as a manifest only jar, but you will have to test this.


Cheers,

Andy

_________________
Rules are only there to be broken


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

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.