You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Lasantha Ranaweera <la...@opensource.lk> on 2007/02/22 07:53:34 UTC

Re: Using Cayenne as a JPA provider in a Web Server

Hi Andrus,

Thank you very much for your informative reply.

BTW I saw .classpath in the agent source code in the cayenne repository. 
Is it necessary one?

Thanks,
Lasantha
Andrus Adamchik wrote:
> Hi Lasantha,
>
> We started on the JPA Guide [1], but it doesn't have much user 
> information yet. Would be nice to get it going, if possible - using 
> your experience ;-) For now the procedure is roughly the following:
>
> * Build Cayenne trunk from source [2] (we need to start publishing 
> snapshots asap, but alas - you have to build it now). Recently adding 
> Geronimo and OpenEJB dependencies to the unit tests results in 
> occasional build instability, so you'd probably have to do this:
>
> mvn -Dmaven.test.skip=true install
>
> and then do the assembly
>
> cd assembly
> mvn package
>
> * Cayenne distro is now under 
> "cayenne/assembly/target/cayenne-3.0-SNAPSHOT.tar.gz", you can unpack 
> it and grab the needed jars as described below.
>
>
> ... From here you can either use maven to declare Cayenne dependency 
> or place needed jars in your app. I will discuss the second scenario, 
> you can infer the first from it.
>
>
> * Place "lib/cayenne-agent-3.0-SNAPSHOT.jar" in the boot directory of 
> the web container and add a "-javaagent:" option to the container 
> startup script per [3].
>
> * Place the provider jar and its dependencies in the application (you 
> can probably put it in a shared container path - I haven't tried it). 
> The files are "lib/cayenne-server-3.0-SNAPSHOT.jar" and all the stuff 
> under "lib/third-party".
>
> * Create "persistence.xml" in WEB-INF/classes of your app. There is 
> probably no need to declare an explicit provider name, but you can 
> still do that to ensure that Cayenne provider is used if you have more 
> than one in the environment:
>
> <provider>org.apache.cayenne.jpa.Provider</provider>
>
> Also if you don't provide a mapping descriptor (i.e. use JPA 
> annotations), you'll have to mention all your entities in 
> persistence.xml under <class>..</class>.
>
> * Cayenne can take care of your DataSource creation per [4], or you 
> can map a JNDI DataSource in Tomcat.
>
> * One big hole in Cayenne JPA implementation is EJBQL support. While 
> we are working on that you can either use raw SQL queries, or limit 
> your testing example to 'persist', 'find', 'remove' and other 
> EntityManager methods that don't require EJBQL queries.
>
> Good luck , and don't hesitate to ask if you have questions or think 
> you found a bug.
>
> Andrus
>
> [1] http://cayenne.apache.org/doc/jpa-guide.html
> [2] http://cayenne.apache.org/building-cayenne.html
> [3] http://cayenne.apache.org/doc/jpa-agent.html
> [4] http://cayenne.apache.org/doc/jpa-cayenne-provider-properties.html
>
> On Feb 21, 2007, at 3:07 PM, Lasantha Ranaweera wrote:
>
>> Hi,
>>
>> Any resources to start Cayenne as a JPA provider in a web server like 
>> Tomcat or Jetty?
>>
>> Thanks,
>> Lasantha
>>
>
>


Re: Using Cayenne as a JPA provider in a Web Server

Posted by Lasantha Ranaweera <la...@opensource.lk>.
Andrus Adamchik wrote:
>
> On Feb 22, 2007, at 8:53 AM, Lasantha Ranaweera wrote:
>
>> BTW I saw .classpath in the agent source code in the cayenne 
>> repository. Is it necessary one?
>
> We do check Eclipse project files to SVN... That's just the preference 
> of our committers (including myself) :-)
>
> Andrus
>
Cool... I am also an Eclipse Fan. :-)

Lasantha


Re: Using Cayenne as a JPA provider in a Web Server

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Feb 22, 2007, at 8:53 AM, Lasantha Ranaweera wrote:

> BTW I saw .classpath in the agent source code in the cayenne  
> repository. Is it necessary one?

We do check Eclipse project files to SVN... That's just the  
preference of our committers (including myself) :-)

Andrus