tell me more icon Generating a Persistence Unit and Java Service Facade

A persistence unit identifies a subset (or possibly all) of the entities included in a deployed project (an EJB JAR or WAR file). The persistence unit associates metadata with this entity group, including whether it runs inside or outside a Java EE container.

A Java service facade is a Java class that wraps JPA entities and provides query and transaction methods. In the IDE you can quickly generate a Java service facade by using the Create Java Service Facade wizard. In the same wizard, you can also create a new persistence unit that is configured to run outside of a container.

To begin generating a persistence unit and Java service facade, you will right-click the persistence.xml file in the Application Navigator and choose New Java Service Facade to launch the Create Java Service Facade wizard.

New Java Service Facade context menu item

In the wizard, you will enter a new service class name and choose to generate a main() method.

Create Java Service Facade wizard

Then you will create a new persistence unit that runs outside of a container.

Create Persistence Unit page of the wizard

After creating a new persistence unit, you will choose to generate all Java service facade methods for the entity.

Java service facade methods

Copyright © 1997, 2009, Oracle. All rights reserved.

false ,,,,,,,,,,,,,,,