You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Michael K <m_...@yahoo.com> on 2010/04/11 15:04:57 UTC

Cayenne and EJB

Hi,

I'm new to cayenne, and I would like to find out whether it is possible to use Cayenne in my EJB3.0 project? 
My plan is to use Cayenne as a persistence engine rather than using the standard EJB entity.
If possible, are there any samples or tutorials that show me where to start?


Thanks in advance.


Michael


      

Re: Cayenne and EJB

Posted by Michael K <m_...@yahoo.com>.
That's fine, I 'll give it a try. Thanks for your prompt response though, that was really quick.


Cheers,

Michael



----- Original Message ----
From: Andrus Adamchik <an...@objectstyle.org>
To: user@cayenne.apache.org
Sent: Tue, April 13, 2010 3:54:43 PM
Subject: Re: Cayenne and EJB

Honestly I have no clue about the EJB configuration details, as I don't use EJB myself. I did write some EJB Cayenne examples ages ago, and I have a conceptual idea of how to integrate Cayenne into an EJB environment, but unfortunately can't provide the low-level details.

Andrus


On Apr 13, 2010, at 10:58 AM, Michael K wrote:
> Thanks Andrus,
> 
> Regarding  the thread-bound ObjectContext , do I still need to configure the ejb's xml file like the one you did with web application (i.e. web.xml)?
> 
> Thanks again for your input.
> 
> 
> Michael



      

Re: Cayenne and EJB

Posted by Andrus Adamchik <an...@objectstyle.org>.
Honestly I have no clue about the EJB configuration details, as I  
don't use EJB myself. I did write some EJB Cayenne examples ages ago,  
and I have a conceptual idea of how to integrate Cayenne into an EJB  
environment, but unfortunately can't provide the low-level details.

Andrus


On Apr 13, 2010, at 10:58 AM, Michael K wrote:
> Thanks Andrus,
>
> Regarding  the thread-bound ObjectContext , do I still need to  
> configure the ejb's xml file like the one you did with web  
> application (i.e. web.xml)?
>
> Thanks again for your input.
>
>
> Michael

Re: Cayenne and EJB

Posted by Michael K <m_...@yahoo.com>.
Thanks Andrus,

Regarding  the thread-bound ObjectContext , do I still need to configure the ejb's xml file like the one you did with web application (i.e. web.xml)?

Thanks again for your input.


Michael


      

Re: Cayenne and EJB

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Michael,

I am not aware of any tutorials specifically dealing with EJB  
integration, but it should definitely be possible to use Cayenne. Two  
things I can think about that may help in the EJB environment:

1. Checking "container managed transactions" for the DataDomain in the  
modeler. This would prevent Cayenne from committing JDBC connections,  
letting the container handle that.

2. Use thread-bound ObjectContext  
(BaseContext.bindThreadObjectContext(..)), so that the same context  
and its ojects can be shared between all EJBs in the same transaction.  
(there may be other patterns of context use as well, this is just most  
common and natural one).

Andrus

On Apr 11, 2010, at 2:04 PM, Michael K wrote:
> Hi,
>
> I'm new to cayenne, and I would like to find out whether it is  
> possible to use Cayenne in my EJB3.0 project?
> My plan is to use Cayenne as a persistence engine rather than using  
> the standard EJB entity.
> If possible, are there any samples or tutorials that show me where  
> to start?
>
>
> Thanks in advance.
>
>
> Michael