Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

JPA Tools Smoke Test

Project creation

  • Create a "New JPA Project"
  • Select the "Generic" Platform and "Java 1.7" facet configuration
  • Set up a DB and library that contains a JPA implementation (this can be Oracle, DB2, MySQL, Sybase, etc...)

Java Source test

  • Create a JPA Entity in the project and add at least 3 attributes
  • Make one of the attributes the Id for the Entity using the JPA Details
  • 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 from Tables...
  • 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 Generic project
  • Paste in the following content
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="1.0" xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd">
		<!--schema></schema-->
	<!--catalog></catalog-->
	<access>FIELD</access>
	<entity name="model.EmployeeEntity" class="model.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"/>
		<exclude-default-listeners/>
		<exclude-superclass-listeners/>
	    <attributes>
			<id name="empId">
				<column name="EMP_ID"/>
				<generated-value strategy="TABLE" generator="EMPLOYEE_GENERATOR_TABLE"/>
			</id>
			<basic name="fName">
				<column name="F_NAME"/>
			</basic>
			<basic name="lName">
				<column name="L_NAME"/>
			</basic>
			<one-to-many name="phones" target-entity="model.Phone" mapped-by="employee">
				<cascade>
					<cascade-all/>
				</cascade>
			</one-to-many>
	    </attributes>
	</entity>
</entity-mappings>
  • Verify that the JPA structure pane displays the correct values
  • Edit the fName 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

EclipseLink

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

Back to the top