Index: jpa/eclipselink.jpa.test/resource/eclipselink-partitioned-model/partitioned-orm.xml =================================================================== --- jpa/eclipselink.jpa.test/resource/eclipselink-partitioned-model/partitioned-orm.xml (revision 9968) +++ jpa/eclipselink.jpa.test/resource/eclipselink-partitioned-model/partitioned-orm.xml (working copy) @@ -12,6 +12,7 @@ + @@ -87,6 +88,14 @@ ValuePartitioningByLOCATION + + + + + + + PinnedPartitioningTEST + Index: jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/partitioned/Employee.java =================================================================== --- jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/partitioned/Employee.java (revision 9968) +++ jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/partitioned/Employee.java (working copy) @@ -18,6 +18,7 @@ import org.eclipse.persistence.annotations.Partitioned; import org.eclipse.persistence.annotations.RoundRobinPartitioning; +import org.eclipse.persistence.annotations.PinnedPartitioning; import org.eclipse.persistence.annotations.ValuePartitioning; import org.eclipse.persistence.annotations.ValuePartition; @@ -42,6 +43,7 @@ @ValuePartition(connectionPool="node3", value="Toronto") }) @Partitioned("ValuePartitioningByLOCATION") +@PinnedPartitioning(name="PinnedPartitioningTEST", connectionPool="node2") public class Employee implements Serializable, Cloneable { @Id @@ -92,6 +94,14 @@ @Partitioned("ValuePartitioningByLOCATION") private List responsibilities; + @ElementCollection + @CollectionTable( + name = "PART_WORK", + joinColumns={@JoinColumn(name = "EMP_ID", referencedColumnName = "EMP_ID"),@JoinColumn(name = "LOCATION", referencedColumnName = "LOCATION")}) + @Column(name="EXPERIENCE") + @Partitioned("PinnedPartitioningTEST") + private List experiences; + @OneToMany(cascade = ALL, mappedBy = "owner", orphanRemoval = true) private Collection phoneNumbers; @@ -104,6 +114,7 @@ this.projects = new ArrayList(); this.managedEmployees = new Vector(); this.responsibilities = new Vector(); + this.experiences = new Vector(); } public Employee(String firstName, String lastName) { @@ -148,6 +159,10 @@ getResponsibilities().add(responsibility); } + public void addExperience(String experience) { + getExperiences().add(experience); + } + public Address getAddress() { return address; } @@ -195,6 +210,10 @@ return responsibilities; } + public List getExperiences() { + return experiences; + } + public Integer getVersion() { return version; } @@ -218,6 +237,10 @@ getResponsibilities().remove(responsibility); } + public void removeExperience(String experience) { + getExperiences().remove(experience); + } + public void setAddress(Address address) { this.address = address; } @@ -262,6 +285,10 @@ this.responsibilities = responsibilities; } + public void setExperiences(List experiences) { + this.experiences = experiences; + } + public void setVersion(Integer version) { this.version = version; } Index: jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/partitioned/EmployeePopulator.java =================================================================== --- jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/partitioned/EmployeePopulator.java (revision 9968) +++ jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/partitioned/EmployeePopulator.java (working copy) @@ -226,6 +226,7 @@ employee.addPhoneNumber(phoneNumberExample1()); employee.addPhoneNumber(phoneNumberExample2()); employee.addResponsibility("Sort files"); + employee.addExperience("The Object People"); employee.setLocation("Calgary"); } catch (Exception exception) { throw new RuntimeException(exception.toString()); Index: jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/partitioned/PartitionedTableCreator.java =================================================================== --- jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/partitioned/PartitionedTableCreator.java (revision 9968) +++ jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/partitioned/PartitionedTableCreator.java (working copy) @@ -26,6 +26,7 @@ addTableDefinition(buildPROJECT_EMPTable()); addTableDefinition(buildPROJECTTable()); addTableDefinition(buildRESPONSTable()); + addTableDefinition(buildWORKTable()); addTableDefinition(buildDEPTTable()); addTableDefinition(buildDEPT_EMPTable()); } @@ -383,7 +384,51 @@ return table; } + + public TableDefinition buildWORKTable() { + TableDefinition table = new TableDefinition(); + // SECTION: TABLE + table.setName("PART_WORK"); + // SECTION: FIELD + FieldDefinition field = new FieldDefinition(); + field.setName("EMP_ID"); + field.setTypeName("NUMERIC"); + field.setSize(15); + field.setShouldAllowNull(false); + field.setIsPrimaryKey(true); + //field.setForeignKeyFieldName("PART_EMPLOYEE.EMP_ID"); + table.addField(field); + + FieldDefinition location = new FieldDefinition(); + location.setName("LOCATION"); + location.setTypeName("VARCHAR"); + location.setSize(64); + location.setShouldAllowNull(false); + location.setIsPrimaryKey(true); + table.addField(location); + + // SECTION: FIELD + FieldDefinition field1 = new FieldDefinition(); + field1.setName("EXPERIENCE"); + field1.setTypeName("VARCHAR"); + field1.setSize(200); + field1.setShouldAllowNull(false); + field1.setIsPrimaryKey(true); + table.addField(field1); + + /*ForeignKeyConstraint foreignKey = new ForeignKeyConstraint(); + foreignKey.setName("FK_PART_WORK"); + foreignKey.setTargetTable("PART_EMPLOYEE"); + foreignKey.addSourceField("EMP_ID"); + foreignKey.addTargetField("EMP_ID"); + foreignKey.addSourceField("LOCATION"); + foreignKey.addTargetField("LOCATION"); + table.addForeignKeyConstraint(foreignKey);*/ + + return table; + } + public TableDefinition buildDEPTTable() { TableDefinition table = new TableDefinition(); table.setName("PART_DEPT");