Dali JPA ToolsAn Eclipse Web Tools Platform Sub-Project | Back |
Getting Started with Dali
To work with Java Persistence Entities you need couple of prerequisites:
- An installed 1.5 JRE or higher
- A Java EE 5 compliant runtime or compliant Java Persistence API implementation. You can download a JPA implementation from Eclipse (EclipseLink) or from a number of other open source and commercial vendors.
- Make sure your Project's Java Compiler Compliance Level is set to 5.0
- Select File->New Project...JPA->JPA Project
- Follow the instructions on the Wizard. You'll need to identify the jar containing the JPA annotation definitions so your entities will compile. You'll also need to select, or define, a database connection that will be used to access relational schema information.
- Create a new Java Class and add this class to your persistence.xml file
- In the JPA Details view, select to map the class as an Entity.
- Or use the New Entity Wizard.
- Open the persistence.xml file using the Persistence XML Editor. Add the class to the Managed Classes list.
- Or simply add the "@Entity" annotation to any existing POJO class definition. The Dali tools will pickup the change and the editing views will activate.
Running JPA Applications 'Out of Container'
How you run your JPA application in a compliant runtime in a Java SE environment ('out of container') is vendor specific. We'll add links to how-to's for any runtime we're told about. Post to the Dali newsgroup or mailing list if you have a how-to you'd like included.
Notes
- In order to compile JPA Entities, it is a requirement that the appropriate jar(s) from a JPA runtime are available on the project classpath. The "Add Java Persistence..." wizard will help you add the required library to your project classpath. You must have previously installed a Java EE 5 or JPA persistence runtime implementation--one is not distributed with Dali. If you are working inside of a WebTools Enterprise Application Project, no classpath configuration is needed as your classpath should already contain the appropriate jars from your Server configuration, assuming the server supports EJB 3.0.
- Currently Dali only supports one Persistence Unit and one Persistence XML file per project. Other configurations can exist in a JPA project, but the validation and defaults processing may not be correct when multiple persistence units are used.