Transcript Document
Dali JPA Tools
About Dali
• Dali JPA Tools is an Eclipse Web Tools Platform
sub-Project
• Dali 1.0 is a part of WTP 2.0 Europa coordinated
release
• Goal - to build extensible frameworks and
exemplary tools for the definition and editing of
object-relational mappings for JPA Entities
• Provide creation and automated initial mapping
wizards, programming assistance such as
dynamic problem identification
Dali Goals
•
Simplicity
•
•
Intuitiveness
•
•
Use existing and consistent modelling and tooling
practices in Eclipse
Compliance
•
•
•
Automated mapping wizards and intelligent mapping
assistance
Support any and all Java Persistence API compliant
runtime implementations
Test using EJB 3.0 JPA Reference Implementation
Extensibility
•
Provide extension points for vendors and open source
projects to add their own value-add features
Information
•
Dali Web Site:
http://www.eclipse.org/webtools/dali/main.php
•
Dali User’s Guide:
http://www.eclipse.org/webtools/dali/docs/dali_user_guide.
pdf
•
Dali Tutorial:
http://www.eclipse.org/webtools/dali/docs/tutorial_1.0/dal
i_jsf_tutorial.pdf
•
Dali Developer Documentation
http://wiki.eclipse.org/index.php/Dali_Developer_Documenta
tion
JPA Development Perspective
• To start using
Dali JPA Tools
in Eclipse open
“JPA Development”
perspective
Basic Steps
•
•
•
•
•
Create a database connection
Create a JPA project
Create persistent Java entities
Associate the entity with a database table
Create OR mapping
• id
• columns
• relationships
Database Connection
• Create database
connection using a
“Data Source Explorer”
view
JPA Details View
• The JPA Details view displays the
persistence information for the currently
selected entity
JPA Structure View
• The JPA Structure view displays an
outline of the structure (its attributes
and mappings) of the entity that is
currently selected or opened in the
editor
Managing the persistence.xml file
• When creating a JPA project, you can also
create the persistence.xml file
• Use the Persistence XML Editor to edit the
persistence.xml file
• Synchronizing classes
• as you work with the classes in your Java
project, you will need to update the
persistence.xml file to reflect the changes
• right-click the persistence.xml file JPA
Tools Synchronize Classes
Generating Entities from Tables
• Procedure to generate Java persistent
entities from database tables
• Right-click the JPA project JPA Tools
Generate Entities
• Eclipse creates a Java persistent entity for
each database table
• Each entity contains fields based on the
table’s columns
• Eclipse will also generate entity relationships
based on the table constrain
Table Generation from Entities
• Generates platform specific tables from
Entities through the DDL generation
• Right-click the JPA project JPA Tools
Generate DDL
Demos
• On the project web site it’s possible to
view visual Demos for:
•
•
•
•
•
Creating a Database Connection
Creating a Database Schema
Creating a JPA Project
Mapping with Annotations
Mapping with XML