Testing standalone Java Persistence bundle
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.
3. Copy classes/META-INF/persistence.xml.template to 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
Notes:
i) 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.
Posted by pcdinh on July 04, 2006 at 01:04 AM PDT #
Posted by 192.18.43.249 on July 10, 2006 at 12:42 PM PDT #