Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2009-04-15 13:48:54 -0400
committerkmoore2009-04-15 13:48:54 -0400
commit8bcd345ebea9ada54b0a665517a41834fd3d4aca (patch)
treeeac68adc5282f42d18806b5fb8efb689a12de37e
parent891597248d7dff361418d4b996cf06d6e29086c1 (diff)
downloadwebtools.dali-8bcd345ebea9ada54b0a665517a41834fd3d4aca.tar.gz
webtools.dali-8bcd345ebea9ada54b0a665517a41834fd3d4aca.tar.xz
webtools.dali-8bcd345ebea9ada54b0a665517a41834fd3d4aca.zip
270871 - patch from Danny Ju - Entity Generation - 1-Many Relationship with composite keys does not add referencedColumnName as it should
-rw-r--r--jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal2/ORMGenColumn.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.gen/templates/entities/join.vm2
2 files changed, 8 insertions, 1 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal2/ORMGenColumn.java b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal2/ORMGenColumn.java
index 51719671b0..e2b39d1bd5 100644
--- a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal2/ORMGenColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal2/ORMGenColumn.java
@@ -200,6 +200,13 @@ public class ORMGenColumn
public boolean isPrimaryKey(){
return this.mDbColumn.isPartOfPrimaryKey() ;
}
+ public boolean isPartOfCompositePrimaryKey(){
+ if( this.mDbColumn.isPartOfPrimaryKey() ){
+ if( DTPUtil.getPrimaryKeyColumnNames( this.mTable ).size()>1 )
+ return true;
+ }
+ return false;
+ }
public boolean isForeignKey() {
return this.mDbColumn.isPartOfForeignKey() ;
}
diff --git a/jpa/plugins/org.eclipse.jpt.gen/templates/entities/join.vm b/jpa/plugins/org.eclipse.jpt.gen/templates/entities/join.vm
index 32117c664c..f52a4b7178 100644
--- a/jpa/plugins/org.eclipse.jpt.gen/templates/entities/join.vm
+++ b/jpa/plugins/org.eclipse.jpt.gen/templates/entities/join.vm
@@ -4,7 +4,7 @@
##macro joinColumn uses $column, $referencedColumn
#macro (joinColumn $column $referencedColumn)
#set ($members = "name=$customizer.quote($column.joinColumnName)")
-#if( !$referencedColumn.primaryKey )
+#if( !$referencedColumn.primaryKey || $referencedColumn.partOfCompositePrimaryKey )
#set ($members = "$members, referencedColumnName=$customizer.quote($referencedColumn.name)")
#end
#if( $customizer.generateDDLAnnotations )

Back to the top