Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.gen/templates/entities/oneToManyMethods.vm')
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.gen/templates/entities/oneToManyMethods.vm16
1 files changed, 16 insertions, 0 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.gen/templates/entities/oneToManyMethods.vm b/jpa/plugins/org.eclipse.jpt.jpa.gen/templates/entities/oneToManyMethods.vm
new file mode 100644
index 0000000000..c0ba0396ec
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.gen/templates/entities/oneToManyMethods.vm
@@ -0,0 +1,16 @@
+##included template. Generates the @OneToMany methods.
+##Assumes that the context has a "role" object representing the generated AssociationRole
+##
+ public $role.referencedTable.className $customizer.propertyAdd($role.propertyName)($role.referencedTable.className $customizer.convertToSingularisedString($role.propertyName)) {
+ $customizer.propertyGetter($role.propertyName)().add($customizer.convertToSingularisedString($role.propertyName));
+ $customizer.convertToSingularisedString($role.propertyName).$customizer.propertySetter($role.oppositeRole.propertyName)(this);
+
+ return $customizer.convertToSingularisedString($role.propertyName);
+ }
+
+ public $role.referencedTable.className $customizer.propertyRemove($role.propertyName)($role.referencedTable.className $customizer.convertToSingularisedString($role.propertyName)) {
+ $customizer.propertyGetter($role.propertyName)().remove($customizer.convertToSingularisedString($role.propertyName));
+ $customizer.convertToSingularisedString($role.propertyName).$customizer.propertySetter($role.oppositeRole.propertyName)(null);
+
+ return $customizer.convertToSingularisedString($role.propertyName);
+ } \ No newline at end of file

Back to the top