Home

 

Testing JPA entities

One of the benefits of JPA entities over CMP beans is that they can be tested outside of a WebSphere application server using a Java class with a main method. JPA entities can also be tested using the JUnit framework. JUnit will be covered in Chapter | 3, Testing using JUnit.

To test the entities, we create an independent project (RAD75JPATest) that links to the JPA project (RAD75JPA). To run JPA outside of the server, we have to use the OpenJPA implementation, and not the JPA implementation of the server. This requires modifications to the persistence.xml file.

ibm.com/redbooks