| |
MyEclipse JPA (Java Persistence) Tools
Toplink :: Hibernate Implementations :: OpenJPA
Eclipse OR Tools: Libraries, Wizards, Java class/database
mapping and velocity templates
This page presents an overview of JPA features available in
MyEclipse (based on MyEclipse 6.0<).
To
get a better feel for MyEclipse and to learn more about JPA or
other features,
please check out the MyEclipse
Educational Materials.
Persistence Providers
MyEclipse provides support for the
Toplink Essentials and
Hibernate 3.2 JPA providers. Support for
OpenJPA is planned.
Adding JPA Capabilities
Database Configuration
Create a persistence unit and associate your project with a
database
and schema for design-time tool support. The project in
the next
screenshot is being associated with the database driver
for the
local
MyEclipse Derby database.
Configure the datasource
You may change a JPA project's database driver association at any
time using the
Java Persistence properties page. To invoke this
page, right click on the
project and select Properties from the
context menu. From the Properties dialog
shown below, expand the
MyEclipse node and select Java Persistence.
Java Persistence properties page
Entity Generation
Initiate Entity generation from the context menu of a JPA project.
This will launch the JPA Reverse Engineering Wizard.
Entity generation from JPA project
Entity generation can also be initiated from the Database
Browser view.
Entity generation from DB Table
The reverse engineering process is fully customizable.
Using the
JPA Reverse Engineering Wizard you can choose the artifacts to
generate and the database tables from which the artifacts will be
based.
Customize reverse engineering
Following are several sample snippets of the code generated by
the Reverse Engineering Processor.
Sample snippets
MyEclipse Java Persistence Perspective
The MyEclipse Java Persistence Perspective provides an optimal
editor and view layout for JPA oriented tasks.
MyEclipse Java Persistence perspective
JPA Details View
The JPA Details view makes it easy to edit entity annotations.
JPA Details view- Select table
JPA Details view - Edit detail
JPA Annotation Table and Column Content Assist
Table Content Assist
JPA annotation column content assist
JPA Entity Validation
Errors in your mapping are detected and displayed in the editor
and problems view.
JPA validation errors shown in Java editor
The
JPA Entity Validator can be enabled or disabled
at the project level.
JPA Validation preferences
Spring 2 Support
When adding JPA Capabilities to a project that already has Spring
capabilities or vice versa,
you can choose advanced Spring-JPA
support. This level of support enables
JPA tools to work with your
project's Spring artifacts.
Following is a screenshot of the
Spring-JPA project configuration wizard.
Adding Spring Capabilities Wizard
Select your primary bean configuration file and customize bean Ids
and transaction support.
Configure Spring-JPA support
Reverse Engineering Entities and Spring DAOs from Database
For projects that are configured to support advanced Spring-JPA
capabilities,
in addition to generating Entity classes from a
database schema,
Spring compatible DAOs can be generated.
During
the reverse-engineering process the Spring application context
file is
updated with generated bean entries for each DOA class.
Generate Spring DAOs.
Generated Spring application context file.
Generated Spring DAO extends from Spring's
JpaDaoSupport.
|