persistence@glassfish.java.net

Re: Shared entities - Container-managed persitence

From: Wouter van Reeven <wouter_at_van.reeven.nl>
Date: Sat, 13 Jun 2009 13:20:56 +0200

Hi Allan,


I'd say you need to create one EJB module and two WEB modules in NetBeans. The
EJB module would need a persistence.xml and the two WEB modules will need to
lookup local session beans from the EJB module to fetch their data. In that
way, only one module is responsible for the database connection (i.e. the EJB
module) and both WEB modules share the same Entities and Entity cache.

Is that what you're after?


HTH, Wouter van Reeven

On Sat, Jun 13, 2009 at 09:05:41AM +0200, Allan Juul wrote:
> hi
>
> [first post here]
>
> is the following scenario possible ?
>
> In my GF webContainer i have two web applications:
>
> /webappWriter
>
> /webappReader
>
>
> these two web apps should access data from the same datasource (mysql
> db) and therefore (hopefully) share the same entity classes.
>
> so these entity classes will be in some "shared" og "common" namespaced
> library.
>
>
> if I create separate identical Entityclasses it seems to work ok, but if
> i factor these out to my common library i get a
>
> ****
> java.lang.IllegalArgumentException: Object:
> my.name.space.common.Item[id=1244876498959]
> is not a known entity type
> ****
>
>
> i imagine i have a persitence.xml issue - because the "common" library
> need its own persitence.xml (at least in netbeans) and so does the
> respective webapps. so which one wins?
>
>
> anyway, any pointers much appreciated
>
> ./allan

-- 
Blackholes are where God is dividing by zero.
[Unknown Source]
Skype: wvreeven
Facebook: wvreeven
Twitter: wvreeven