Lab: Using Jdeveloper 10G For Creating The Persistence Layer With Ejb 3.0
Lab: Using Jdeveloper 10G For Creating The Persistence Layer With Ejb 3.0
Introduction
In this lab you learn how to use some of the new features in EJB 3.0
specification. You will also develop and deploy Session and Entity beans
using EJB 3.0 annotations, new POJO-based model persistence, and the
Entity Manager API to create, update, delete and query the POJO
persistence model.
In this example you will create persistence objects for the Loans and
Loan_Customer tables, implemented as Entities. Methods for adding a
new loan provider, retrieving loan data, and returning the credit rating for a
loan customer are implemented in a session bean, using the Entity
Manager API.
Getting Started
Click Next.
Click Next.
6. Accept the defaults in step 4 of 4 and click Finish.
7. Double click the Loans.java node in the application navigator to open
it in the source editor.
8. Note the following EJB 3.0 named query is generated for you
automatically:
@NamedQuery(name = "Loans.findAll", query = "select o from
Loans o")
4. In Step 3 of 4, make sure the full name for the Bean Class is
buslogic.LoanAppFacadeBean, then Next.
10. Ensure that a new Loan is added to the table, utilizing the sequence
you specified for the Id. In the connection tab expand Database |
ODD | Tables | LOANS and click the Data tab in the editor. Note that
you can view the SQL in the OC4J command window.
3. Add a comma after the provided query, and then add the following
query between the comma and the end parenthesis:
@NamedQuery(name = "LoanCustomer.findBySSN",
query="select loancustomer from LoanCustomer loancustomer
where loancustomer.ssn = :ssn")