Cayenne User Documentation
JPA Agent

Cayenne JPA provider requires enhancement of the Entity classes. In J2EE environment container takes care of registering the enhancer classes. In J2SE environment (such as command-line applications, or web containers like Jetty or Tomcat) runtime class enhancement is more tricky.

A common portable approach to integrate enhancer in J2SE environment is via Java instrumentation API (see `java.lang.instrument` package documentation for details). This requires Cayenne "agent" to be specified in the JVM startup options. Cayenne Agent is a special jar file that comes with Cayenne distribution called `"cayenne-agent-x.x.x.jar"`. It has no external dependencies (not even on Cayenne itself).

- Command-line example:

      java -javaagent:/path/to/cayenne-agent-xxxx.jar org.example.Main

- Jetty Example
  TODO

- Tomcat Example
  TODO

.
Copyright ©2001-2007 Apache Software Foundation