You can work in JDeveloper's IDE to create a JPA application that uses JPA entities and a simple Java service facade that runs outside the Java EE container.
Install the Schema: Download the schema zip file from OTN and install it. The cue cards use tables that are part of the Fusion Order Demo (FOD) schema.
Create a New Application: Use the Create Application wizard to create a generic application.
Create a Database Connection: Use the Create Database Connection dialog to create a connection to the schema.
Create JPA Entities: Use the Create Entities from Tables wizard to create JPA entities from existing database tables.
Generate a Java Service Facade: Use the Create Java Service Facade wizard to create a Java service facade that has a
Generate a Persistence Unit: Use the Create Java Service Facade wizard to generate a persistence unit that is configured to run outside the Java EE container.
Add Code and Run the Java Service Facade: Add code to the
main() method and run the Java service facade.
The steps and examples in the cue cards are based on tables that are part of the Fusion Order Demo (FOD) schema. This schema is also used as the database for the sample application that ships with Oracle JDeveloper 11g, as well as other collateral in this release. It will be convenient to have this schema installed, and you only need to do it once. If you have already installed the FOD schema, you can skip this step and go directly to the next card. [ tell me more...]
jdeveloper.home, and all the
db.*settings). Keep all other properties set to their default values. The demo user must be named FOD.
/jdeveloperdirectory where you have JDeveloper installed, for example,
After running the Ant task, you should see a build successful message in the JDeveloper Log window. [ tell me more...]
The JDeveloper application is the highest level in the organizational structure. It stores information about the objects you are working with, while you are creating your application. It keeps track of your projects and the environment settings. [ tell me more...]
Application templates provide you with a quick way to create the project structure for standard applications with the appropriate combination of technologies already specified. The new application created from the template appears in the Application Navigator already partitioned into tiered projects, with the associated technology scopes set in each project. [ tell me more...]
When you complete the steps for creating a new application and project, the Projects panel in the Application Navigator should look like this: [ tell me more...]
You can connect to any database for which you have connection details, or install the sample schema used in the cue card examples and then establish a connection to it. If you installed the sample schema, you will be able to follow the steps in the cue cards exactly as written. If you work with your own database, you can supply your own values as needed. [ tell me more...]
FODfor the connection name and
fodfor the username.
When you complete the steps for creating a database connection, the Application Navigator should look similar to this when you expand the Application Resources panel. The database connection is now included as a resource for your application under the Connections | Database nodes. [ tell me more...]
The Enterprise JavaBeans (EJB) 3.0 specification includes an additional persistence specification called the Java Persistence API (JPA), which is an API for creating, removing and querying across lightweight Java objects. The EJB 3.0 specification no longer refers to entities as "beans", they are now JPA entities.[ tell me more...]
By using the Create Entities from Tables wizard, you can create more than one entity at the same time. In the example, you will select one table in the FOD schema to create the JPA entity. [ tell me more...]
The Java Persistence API (JPA), part of the Java Enterprise Edition 5 (Java EE 5) Enterprise Java Beans (EJB) 3.0 specification, greatly simplifies Java persistence. It provides an object-relational mapping approach that allows you to declaratively define how to map Java objects to relational database tables in a standard, portable way that works both inside a Java EE 5 application server and outside an EJB container in a Java Standard Edition (Java SE) 5 application. [ tell me more...]
When you complete the steps for creating entities from tables, JDeveloper displays messages in the EJB Log window: [ tell me more...]
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. [ tell me more...]
Unlike a session facade, a Java service facade does not run inside the container, so you do not need to create another sample client to call methods. You can use the Java service facade as its own client by adding a
main() method in the Java service class. [
tell me more...]
Project1-Outside. Confirm that JDBC Connection is selected and the database connection you created is selected on the dropdown list (for example, FOD). Then click Next .
In the previous cue card, when you used the Create Entities from Tables wizard to create the JPA entity, JDeveloper automatically created a default persistence unit
Project1 in the
persistence.xml file. That default persistence unit is configured to run inside a Java EE container. [
tell me more...]
When you use the wizard to create a Java service facade, you can choose to generate Java service facade methods for every entity in the selected persistence unit (if there is more than one entity). [ tell me more...]
When you complete the steps for creating the persistence unit and Java service facade, the IDE should look similar to this: [ tell me more...]
To create a runnable Java service facade, you will add implementation code to the
main() method. [
tell me more...]
When you click R un , JDeveloper first saves and compiles the project. The details of the compile are shown in the Messages Log window. Then the Running Log window opens, displaying the result of the execution of the class running outside the Java EE container, and returning a list of product names: [ tell me more...]
Copyright © 1997, 2009, Oracle. All rights reserved.false ,,,,,,,,,,,,,,,