JPA: persistence with EclipseLink
Jul 13, 10 by Juan Lebrijo about Database, blog, Eclipse, Java
Today we will see how to make the persistence in a Eclipse project with EclipseLink JPA implementation. We will base in the last post Eclipse project. In the project properties (right buton) we will add the power to manage JPA entities, adding the facet:
eclipselink_facet.thumbnail.png 11.1 KB
We will ue EclipseLink 1.1.2, it is the JPA implementation by defect in WebLogic 11g.

Generating entities from tables

Over the project, in the contextual menu (right button), JPA > Generate Entities from Tables... We choose the conection SCHOOL, created in other posts, and tables REGISTRY and SCHOOLCERTIFICATES. Generating the entities in the package lebrijo.school.model:
gen_entities_from_tables.thumbnail.png 9.55 KB
To maintain the JPA coherence we must add an Identifier on every classes, Registry has one, but we must add one to SchoolCertificates:
add_id.png 22.9 KB
You may see the file src/META-INF/persistence.xml, how it configures the connection and map the entities.
org.eclipse.persistence.jpa.PersistenceProvider
 	lebrijo.school.model.Registry

 	lebrijo.school.model.Schoolcertificate
		
			
			
			
			
			
			
		
 
here I leaveth eclipse zip project after these steps.