FAQ
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

Search Discussions

  • Andrus Adamchik at Feb 22, 2007 at 12:10 pm

    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
  • Lasantha Ranaweera at Feb 23, 2007 at 4:30 am

    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categoriescayenne
postedFeb 22, '07 at 6:54a
activeFeb 23, '07 at 4:30a
posts3
users2
websitecayenne.apache.org

People

Translate

site design / logo © 2022 Grokbase