users@glassfish.java.net

Re: Two EJB modules inside one EAR and entity manager

From: Sahoo <Sahoo_at_Sun.COM>
Date: Thu, 11 Oct 2007 11:52:37 +0530

See if [1] helps in clarifying PC Propagation issues.

Thanks,
Sahoo

[1]
http://weblogs.java.net/blog/ss141213/archive/2006/10/persistence_con.html

Marina Vatkina wrote:
> Witold Szczerba wrote:
>> 2007/10/10, Marina Vatkina <Marina.Vatkina_at_sun.com>:
>>
>>> Hi Witold,
>>>
>>> You do need to put your entities into a separate jar into ear's lib/
>>> directory.
>>
>>
>> That is what I really wanted to avoid, because using separate jar for
>> entities is not so comfortable :/
>> If I would do that - where am I suppose to place persistence.xml file?
>
> Into entities.jar
>
>> Inside that jar, so it would be available for all EJB modules or each
>> module has to declare its own persistence.xml and specify every entity
>> class - one by one inside its own PU?
>
> No, by that they'll share the same PU.
>
>>
>>
>>> By having them inside a module, you limit their scope/visibility to
>>> that module
>>> only. A global PU means that it's shared, not duplicated, and if you
>>> inject an
>>> EM in your EJBs, the beans participating in the same transaction
>>> will share the
>>> same persistence context.
>>
>>
>> This is really strange to me. Session beans are inside EJB module and
>> you can call them from everywhere... I can't see why this is not the
>> case with entity manager.
>
> It's the scoping rules of PUs. Did you read 6.2.2 Persistence Unit
> Scope of the JPA spec?
>
> HTH,
> -marina
>
>>
>>
>>> -marina
>>
>> Thanks,
>> Witold Szczerba
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>