Quick Start has been edited by Marc Prud'hommeaux (Nov 11, 2006).

(View changes)

Content:

Getting Started Quickly with OpenJPA

This page provides a short (5 minutes) quick start guide for OpenJPA using the example provided with the distribution. For further information, the documentation provides comprehensive documentation on all aspects of configuring and using OpenJPA.

Getting Started with OpenJPA in Eclipse

  1. Download the OpenJPA binary release from the downloads page and unpack it by double-clicking it.
  2. Launch Eclipse (this sample was tested with Eclipse 3.2.1, but any recent version should work)
  3. Select the File menu, traverse to the New sub-menu, and select Project
  4. On the Select a wizard page, select Java Project from Existing Ant Buildfile, then click the Next button
  5. Hit the Browse button next to the Ant Buildfile field, and navigate to the unpacked OpenJPA zip file on the desktop, then traverse through examples, then hellojpa, and select the build.xml file and hit the Open button.
  6. Hit the Finish button on the wizard
  7. A new project will open, containing the OpenJPA jar and all its dependencies
  8. On the Package Explorer, expand the top-level folder, then the examples folder, then hellojpa
  9. Select the build.xml file in the hellojpa folder (note that there is also a build.xml file in the parent folder, which should not be selected). Right-click the build.xml file, and select the Run As sub-menu, then select Ant Build.
  10. The database will be initialized (using the stand-alone Derby database, which is included with the OpenJPA distribution) and the Main.java class will be run. In the Console, you should see the text Hello Persistence!.
  11. Congratulations! You have run your first sample program using OpenJPA. Examine the Main.java example program, as well as the Message.java entity class, play with them by adding fields and working on new persistence operations. Have fun!

Getting Started with OpenJPA from the Console

  1. Ensure that you have Apache Ant installe (this sample was tested with ant 1.6.5, but any recent version should work)
  2. Download the OpenJPA binary release from the downloads page and unpack it by double-clicking it.
  3. Launch a console
  4. Change directories to the Desktop, then cd to the unpacked OpenJPA folder
  5. cd to the examples subdirectory, then to the hellojpa subdirectory
  6. Run ant, which will compile the classes and run the sample application. At the end of the build, you should see the text Hello Persistence!.
  7. Congratulations! You have run your first sample program using OpenJPA. Examine the Main.java example program, as well as the Message.java entity class, play with them by adding fields and working on new persistence operations. Have fun!

Powered by Atlassian Confluence (Version: 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request

Unsubscribe or edit your notifications preferences