Community
Participate
Working Groups
Dali JPA Entity Gen. Given the Field Value: //bi-directional many-to-one association to Employee @OneToMany(mappedBy="employee") private Set<Employee> employees; Generate Additional Methods: public Employee addEmployees(Employee employees) { getEmployees().add(employees); employees.setEmployee(this); return employees; } public Employee removeEmployees(Employee employees) { getEmployees().remove(employees); employees.setEmployee(null); return employees; } How things are derived in the template: -Condition: given that the cardinality is one to many and bi-directional. -Where getEmployees is derived from the AssociationRole Property Name. -Where Set or List extend Collection: getEmployees: add, remove -Where the Method Parameter is the AssociationRole.ReferencedTable.ClassName -Where the method parameter variable get/set method is the AssociationRole.OppositeRole.PropertyName.
Eclipse Version: 3.7.2 Build id: M20120208-0800
Created attachment 220765 [details] Proposed Patch
Created attachment 220943 [details] Updated Patch Updated patch based off of webtools dali tag v201205020001.
Chris...was just taking a look at this patch for SR2. One useful change would be to "singularise" the collection name so you could end up with names like, "addEmployee()" and "removeEmployee()". Take a look at org.eclipse.jpt.jpa.gen.internal.util.StringUtil.singularise().
*** Bug 137581 has been marked as a duplicate of this bug. ***
Created attachment 225194 [details] Updated Patch With Singularise This updated patch uses singularise for the method name and var name creation.
Testing of the patch has gone well, some minor changes for generated code formatting. Waiting for this week's build declare to commit.
Committed to Juno SR2 maintenance and Master branches.