users@glassfish.java.net

Re: Style question about returning JPA entities from EJB

From: Ryan de Laplante <ryan_at_ijws.com>
Date: Fri, 09 Nov 2007 20:34:06 -0500

That makes sense, I forgot that JPA can be used in Java SE. I thought
that the persistence.xml must be in an EJB jar or WAR file.


Thanks,
Ryan

Marina Vatkina wrote:
> Normally it will leave with the entities, which will also allow you to
> test your PU outside the container. But if you have some reasons to
> exclude it, it can be placed with the component (with the <jar-file>
> element (see the spec) "specified relative to the root of the
> persistence unit (e.g., utils/myUtils.jar).".
>
> Regards,
> -marina
>
> Ryan de Laplante wrote:
>> Thank you. The persistence.xml would still live inside of the EJB
>> project, right?
>>
>> Thanks,
>> Ryan
>>
>> Marina Vatkina wrote:
>>
>>> I think your best option would be to use a separate jar for the
>>> entities that is placed under <ear>/lib directory.
>>>
>>> Regards,
>>> -marina
>>>
>>> Ryan de Laplante wrote:
>>>
>>>> I'm not sure where else to ask a question like this.
>>>>
>>>> Back in the EJB 2.x days with CMP, the CPM entities were not
>>>> returned by session beans. The entity would be converted into POJO
>>>> value objects before being returned. I used to put the value
>>>> object POJOs in a common jar file that the EJB project and EJB
>>>> client project would depend on.
>>>> In the Java EE5 world, I have been returning the actual JPA
>>>> entities from my EJB3 session beans. Since the JPA entity classes
>>>> live inside of the EJB jar file, the persistence.xml lives in there
>>>> too, and my web project has a build dependency on the EJB project.
>>>> This hasn't been a big deal for me since I use EJB Local, but I've
>>>> always wondered if this is the right way to do it.
>>>>
>>>> Can anyone share with me the Java EE5 patterns you use, or links to
>>>> pages that talk about this?
>>>>
>>>>
>>>> Thanks,
>>>> Ryan
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>