Testing standalone Java Persistence bundle
By Marina Vatkina on Apr 25, 2006
Yes, I tried it, and it works :)
1. Download the latest bundle from the https://glassfish.dev.java.net/downloads/persistence/JavaPersistence.html page and install it following the instructions. The bundle will be unpacked to ./glassfish-persistence directory.
2. Download the Java SE example from the example page: https://glassfish.dev.java.net/javaee5/persistence/persistence-example.html and unzip it. There are rumors that the link to the zip files does not work, but I couldn't reproduce the problem on Solaris or Windows.
classes/META-INF/persistence.xml and set your database and driver properties. Create the tables using
sql/tables_oracle.sql or modify it for your database
4. Change location to
classes directory, and execute the test:
java -cp [driver-location]:. -javaagent:[install-location]/glassfish-persistence/toplink-essentials-agent.jar client.Client
You should see the expected output:
Inserting Customer and Orders... OK
Verifying that all are inserted... OK
Removing all... OK
Verifying that all are removed... OK
toplink-essentials.jar is automatically added to the classpath by the manifest in the agent jar.
ii) All javax.persistence API and xml schemas are part of the
toplink-essentials.jar, which means that you don't need any other jar in the classpath for the compilation.
iii) You can skip the
-javaagent call if your environment doesn't allow to plug in the agent - the only side effect is loading all relationship as EAGER.