Dali JPA Tools
An Eclipse Web Tools Platform Sub-Project
Getting Started with Dali 0.5
To work with Java Persistence Entities you need couple of prerequisites:
- An installed 1.5 JRE
- A Java EE 5 compliant runtime or compliant Java Persistence API implementation. You can download a JPA implementation from Oracle, JBoss, or BEA. The Java EE 5 reference implementation Glassfish also ships with the TopLink Essentials JPA Reference Implementation.
- Make sure your Project's Java Compiler Compliance Level is set to 5.0
- Switch to the "Persistence Perspective"--you don't have to but this perspective contains the views that support entity editing.
- Right-click on a Java Project and choose Java Persistence -> Add Java Persistence... (see the viewlet demo Adding Persistence to a 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.
- Right-click on your Java Project and choose New -> Other -> Java Persistence -> Entity
- Or, you can create a new Java class and simply add the "@Entity" annotation to it. The Dali tools will pickup the change and the editing views will activate.
- Right-click on your Class in the Package Explorer and choose Persistence -> Make Java Persistence Entity
- 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.
- 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.
- When starting a new workbench session, it is currently necessary to re-connect to your database if you are working on-line with the DB. This allows the Dali plug-in to provide DB related mapping assistance and validation.