16.10.2015 Views

Getting Started with WebSphere Application Server

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 5 – Enterprise Java Beans 103<br />

……<br />

}<br />

Listing 5.12 – definition of the entity Student<br />

5. Update persistence.xml<br />

Add configuration information to persistence.xml which should look as shown in Listing<br />

5.13<br />

<br />

<br />

<br />

<br />

org.apache.openjpa.persistence.PersistenceProviderImpl<br />

<br />

jdbc/Student<br />

com.ibm.start.wasce.student.Student<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Listing 5.13 – persistence.xml for JPA project ejb-studentjpa<br />

6. Create an EJB<br />

Step 1:<br />

Choose File -> New->Other…-> EJB project, ejb-studentejb then create the interface<br />

StudentEJBInterface and its implementation class StudentEJB as shown in Listings<br />

5.14 and 5.15<br />

package com.ibm.start.wasce.studentejb;<br />

import java.util.List;<br />

import javax.ejb.Local;<br />

@Local<br />

public interface StudentEJBInterface {<br />

public List calculateCredit();

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!