Skip to main content
Jump to: navigation, search

JPA Tools Smoke Test

Project creation

  • Create a J2EE "Utility project" or "New JPA Project" under the "JPA" folder
  • Select the "Utility JPA Project with Java 5.0" configuration
  • Set up a Derby DB and library that contains a JPA implementation

Java Source test

  • Create a new Java class in the project and make it an Entity using the JPA Details UI
  • Create an attribute and make it the Id for the Entity
  • Verify that the appropriate annotations have been inserted into the Java source

Generate annotated source

  • Right-click on the project and select JPA Tools->Generate Entities...
  • Examine the generated Entities
  • Edit an @Column name to be wrong and ensure that validation picks up the error

orm.xml test

  • Create a new orm.xml file in the src or meta-inf directory of your Utility project
  • Paste in the following content
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="1.0" xmlns="" xmlns:xsi="" xsi:schemaLocation="">
	<entity name="EmployeeEntity" class="Employee">
	    <table name="Employee"/>
		<table-generator name="EMPLOYEE_GENERATOR_TABLE" table="EMP_SEQ" pk-column-name="SEQ_NAME" value-column-name="SEQ_COUNT" pk-column-value="EMP_SEQ"/>
			<id name="employeeId">
				<column name="EMP_ID"/>
				<generated-value strategy="TABLE" generator="EMPLOYEE_GENERATOR_TABLE"/>
			<basic name="firstName">
				<column name="F_NAME"/>
			<basic name="lastName">
				<column name="L_NAME"/>
			<one-to-many name="phones" target-entity="Phone" mapped-by="empId">
  • Verify that the JPA structure displays the correct values
  • Edit the firstName mapping and confirm that the file and or UI is updated

Project Explorer

  • Open the Project Explorer view and verify that the content is correct


  • Perform all of the above steps to test the EclipseLink extension

Back to the top