Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "JPA Tools Smoke Test"
Line 1: | Line 1: | ||
Project creation | Project creation | ||
− | *Create a J2EE Utility project or New JPA Project under the "JPA" folder | + | *Create a J2EE "Utility project" or "New JPA Project" under the "JPA" folder |
*Select the "Utility JPA Project with Java 5.0" configuration | *Select the "Utility JPA Project with Java 5.0" configuration | ||
*Open the JPA Details and JPA Structure views | *Open the JPA Details and JPA Structure views | ||
Line 11: | Line 11: | ||
orm.xml test | orm.xml test | ||
*Create a new orm.xml file in the src or meta-inf directory of your Utility project | *Create a new orm.xml file in the src or meta-inf directory of your Utility project | ||
− | *Paste the following content | + | *Paste in the following content |
− | + | <pre> | |
+ | <?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="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"/> | ||
+ | <exclude-default-listeners/> | ||
+ | <exclude-superclass-listeners/> | ||
+ | <attributes> | ||
+ | <id name="employeeId"> | ||
+ | <column name="EMP_ID"/> | ||
+ | <generated-value strategy="TABLE" generator="EMPLOYEE_GENERATOR_TABLE"/> | ||
+ | </id> | ||
+ | <basic name="firstName"> | ||
+ | <column name="F_NAME"/> | ||
+ | </basic> | ||
+ | <basic name="lastName"> | ||
+ | <column name="L_NAME"/> | ||
+ | </basic> | ||
+ | <one-to-many name="phones" target-entity="Phone" mapped-by="empId"> | ||
+ | <cascade> | ||
+ | <cascade-all/> | ||
+ | </cascade> | ||
+ | </one-to-many> | ||
+ | </attributes> | ||
+ | </entity> | ||
+ | </entity-mappings> | ||
+ | </pre> | ||
*Verify that the JPA structure displays the correct values | *Verify that the JPA structure displays the correct values | ||
*Edit the firstName mapping and confirm that the file and or UI is updated | *Edit the firstName mapping and confirm that the file and or UI is updated |
Revision as of 13:33, 11 January 2007
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
- Open the JPA Details and JPA Structure views
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
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="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="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"/> <exclude-default-listeners/> <exclude-superclass-listeners/> <attributes> <id name="employeeId"> <column name="EMP_ID"/> <generated-value strategy="TABLE" generator="EMPLOYEE_GENERATOR_TABLE"/> </id> <basic name="firstName"> <column name="F_NAME"/> </basic> <basic name="lastName"> <column name="L_NAME"/> </basic> <one-to-many name="phones" target-entity="Phone" mapped-by="empId"> <cascade> <cascade-all/> </cascade> </one-to-many> </attributes> </entity> </entity-mappings>
- Verify that the JPA structure displays the correct values
- Edit the firstName mapping and confirm that the file and or UI is updated