Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2009-04-17 09:48:59 -0400
committerkmoore2009-04-17 09:48:59 -0400
commitefdb5990fbe9478740f476421611ec12eab80ae8 (patch)
treed7341182e3a1bbf6561ce2526d24d54573171a89
parent74db39207e51a501e622d194bcf50b42f7ffb15f (diff)
downloadwebtools.dali-efdb5990fbe9478740f476421611ec12eab80ae8.tar.gz
webtools.dali-efdb5990fbe9478740f476421611ec12eab80ae8.tar.xz
webtools.dali-efdb5990fbe9478740f476421611ec12eab80ae8.zip
268552 - patch from Danny Ju - Entity Generation - fully qualified class names generated
-rw-r--r--jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal2/ORMGenColumn.java129
-rw-r--r--jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal2/ORMGenTable.java122
-rw-r--r--jpa/plugins/org.eclipse.jpt.gen/templates/entities/join.vm3
-rw-r--r--jpa/plugins/org.eclipse.jpt.gen/templates/entities/main.java.vm14
4 files changed, 196 insertions, 72 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 e2b39d1bd5..20d1ed3239 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
@@ -33,31 +33,40 @@ public class ORMGenColumn
private Table mTable;
private Column mDbColumn;
private ORMGenCustomizer mCustomizer;
- private static String JAVA_LANG_PACKAGE = "java.lang.";
+ private ORMGenTable mGenTable;
+ private static String JAVA_LANG_PACKAGE = "java.lang."; //$NON-NLS-1$
public ORMGenColumn(Column dbColumn, ORMGenCustomizer customizer) {
super();
mDbColumn = dbColumn;
mCustomizer = customizer;
- mTable = dbColumn.getTable() ;
+ mTable = dbColumn.getTable();
}
+
public ORMGenCustomizer getCustomizer() {
return mCustomizer;
}
+ public void setGenTable(ORMGenTable ormGenTable) {
+ mGenTable = ormGenTable;
+ }
+
protected String customized(String propName) {
return getCustomizer().getProperty(propName, mTable.getName(), getName());
}
+
protected boolean customizedBoolean(String propName) {
return getCustomizer().getBooleanProperty(propName, mTable.getName(), getName());
}
+
protected void setCustomized(String propName, String value) {
if (value != null && value.length() == 0) {
value = null;
}
getCustomizer().setProperty(propName, value, mTable.getName(), getName());
}
+
protected void setCustomizedBoolean(String propName, boolean value, boolean defaultValue) {
if (defaultValue == value) {
setCustomized(propName, null); //remove the property
@@ -72,16 +81,16 @@ public class ORMGenColumn
public String getName() {
String annotationName = this.mCustomizer.getDatabaseAnnotationNameBuilder().
buildColumnAnnotationName(mDbColumn.getName(), mDbColumn);
- return annotationName!=null ? annotationName : mDbColumn.getName();
+ return annotationName != null ? annotationName : mDbColumn.getName();
}
public String getJoinColumnName(){
String annotationName = this.mCustomizer.getDatabaseAnnotationNameBuilder().
buildJoinColumnAnnotationName(mDbColumn);
- return annotationName!=null ? annotationName : mDbColumn.getName();
+ return annotationName != null ? annotationName : mDbColumn.getName();
}
- public Column getDbColumn(){
+ public Column getDbColumn() {
return this.mDbColumn;
}
@@ -97,6 +106,7 @@ public class ORMGenColumn
}
return name;
}
+
public void setPropertyName(String name) {
if (!StringUtil.equalObjects(name, getPropertyName())) {
setCustomized(PROPERTY_NAME, name);
@@ -124,7 +134,7 @@ public class ORMGenColumn
// String dbColumnName = getName();
// return propName.equalsIgnoreCase( dbColumnName );
String annotationName = this.mCustomizer.getDatabaseAnnotationNameBuilder().
- buildColumnAnnotationName(propName , this.mDbColumn );
+ buildColumnAnnotationName(propName, this.mDbColumn );
return annotationName==null;
}
@@ -138,11 +148,16 @@ public class ORMGenColumn
if (type == null) {
type = getCustomizer().getPropertyTypeFromColumn( this.mDbColumn );
}
- if( type.startsWith(JAVA_LANG_PACKAGE) ){
+ if( type.startsWith(JAVA_LANG_PACKAGE) ) {
type = type.substring( JAVA_LANG_PACKAGE.length() );
}
return type;
}
+
+ public String getSimplePropertyType() {
+ return mGenTable.getSimplifiedColType( getPropertyType() );
+ }
+
public void setPropertyType(String type) {
if (!StringUtil.equalObjects(type, getPropertyType())) {
setCustomized(PROPERTY_TYPE, type);
@@ -152,10 +167,10 @@ public class ORMGenColumn
* Returns true if the column type is numeric.
*/
public boolean isNumeric() {
- boolean ret = this.mDbColumn.isNumeric() ;
+ boolean ret = this.mDbColumn.isNumeric();
return ret;
-
}
+
/**
* Returns the mapping kind, one of {@link #PROPERTY_MAPPING_KIND}|{@link #ID_MAPPING_KIND}
* |{@link #VERSION_MAPPING_KIND}|{@link #TIMESTAMP_MAPPING_KIND}.
@@ -174,66 +189,72 @@ public class ORMGenColumn
}
return kind;
}
+
public void setMappingKind(String mappingKind) {
if (!StringUtil.equalObjects(mappingKind, getMappingKind())) {
setCustomized(MAPPING_KIND, mappingKind);
}
}
+
public boolean isNullable() {
return this.mDbColumn.isNullable();
}
public int getSize() {
- if( this.mDbColumn.isNumeric()){
+ if ( this.mDbColumn.isNumeric()){
return mDbColumn.getPrecision();
}
return mDbColumn.getLength();
}
public int getDecimalDigits() {
- if( this.mDbColumn.isNumeric() ){
+ if ( this.mDbColumn.isNumeric() ){
return mDbColumn.getScale();
}
return -1;
}
- public boolean isPrimaryKey(){
- return this.mDbColumn.isPartOfPrimaryKey() ;
+ public boolean isPrimaryKey() {
+ return this.mDbColumn.isPartOfPrimaryKey();
}
- public boolean isPartOfCompositePrimaryKey(){
- if( this.mDbColumn.isPartOfPrimaryKey() ){
- if( DTPUtil.getPrimaryKeyColumnNames( this.mTable ).size()>1 )
+
+ 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() ;
+
+ public boolean isForeignKey() {
+ return this.mDbColumn.isPartOfForeignKey();
}
- public boolean isUnique() {
- return this.mDbColumn.isPartOfUniqueConstraint() ;
+
+ public boolean isUnique() {
+ return this.mDbColumn.isPartOfUniqueConstraint();
}
+
public String getPropertyDescription() {
return customized(PROPERTY_DESC);
}
- public boolean isDataTypeLOB(){
+ public boolean isDataTypeLOB() {
return this.mDbColumn.isLOB();
}
- public boolean isNeedMapTemporalType(){
+ public boolean isNeedMapTemporalType() {
String propertyType = this.getPropertyType();
- return ( propertyType.equals("java.util.Date") || propertyType.equals("java.util.Calendar") );
+ return ( propertyType.equals("java.util.Date") || propertyType.equals("java.util.Calendar") ); //$NON-NLS-1$ //$NON-NLS-2$
}
- public String getTemporalType(){
+ public String getTemporalType() {
String defaultType = getCustomizer().getPropertyTypeFromColumn( this.mDbColumn );
- if( defaultType.equals("java.sql.Date")){
- return "DATE";
- }else if( defaultType.equals("java.sql.Time")){
- return "TIME";
+ if( defaultType.equals("java.sql.Date")){ //$NON-NLS-1$
+ return "DATE"; //$NON-NLS-1$
+ }else if( defaultType.equals("java.sql.Time")){ //$NON-NLS-1$
+ return "TIME"; //$NON-NLS-1$
}else {
- return "TIMESTAMP";
+ return "TIMESTAMP"; //$NON-NLS-1$
}
}
@@ -249,11 +270,13 @@ public class ORMGenColumn
}
return scope;
}
+
public void setPropertyGetScope(String scope) {
if (!StringUtil.equalObjects(scope, getPropertyGetScope())) {
setCustomized(PROPERTY_GET_SCOPE, scope);
}
}
+
/**
* Returns the generated property setter scope, one of {@link #PUBLIC_SCOPE}|{@link #PROTECTED_SCOPE}
* |{@link #PRIVATE_SCOPE}.
@@ -266,11 +289,13 @@ public class ORMGenColumn
}
return scope;
}
+
public void setPropertySetScope(String scope) {
if (!StringUtil.equalObjects(scope, getPropertySetScope())) {
setCustomized(PROPERTY_SET_SCOPE, scope);
}
}
+
/**
* Returns the generated field member scope, one of {@link #PUBLIC_SCOPE}|{@link #PROTECTED_SCOPE}
* |{@link #PRIVATE_SCOPE}.
@@ -283,6 +308,7 @@ public class ORMGenColumn
}
return scope;
}
+
/**
* Returns true if this column should be used in the
* <code>equals</code> method implementation.
@@ -290,9 +316,11 @@ public class ORMGenColumn
public boolean isUseInEquals() {
return customizedBoolean(USE_IN_EQUALS) || isPrimaryKey();
}
+
public void setUseInEquals(boolean value) {
setCustomizedBoolean(USE_IN_EQUALS, value, false);
}
+
/**
* Returns true if this column should be used in the
* <code>toString</code> method implementation.
@@ -300,44 +328,51 @@ public class ORMGenColumn
public boolean isUseInToString() {
return customizedBoolean(USE_IN_TO_STRING) || isPrimaryKey();
}
+
public void setUseInToString(boolean value) {
setCustomizedBoolean(USE_IN_TO_STRING, value, false);
}
+
public boolean isUpdateable() {
- return !"false".equals(customized(UPDATEABLE)); //defaults to true
+ return !"false".equals(customized(UPDATEABLE)); //defaults to true //$NON-NLS-1$
}
+
public void setUpdateable(boolean value) {
setCustomizedBoolean(UPDATEABLE, value, true);
}
+
public boolean isInsertable() {
- return !"false".equals(customized(INSERTABLE)); //defaults to true
+ return !"false".equals(customized(INSERTABLE)); //defaults to true //$NON-NLS-1$
}
+
public void setInsertable(boolean value) {
setCustomizedBoolean(INSERTABLE, value, true);
}
+
public boolean isGenerated() {
- return !"false".equals(customized(GENERATED)); //defaults to true
+ return !"false".equals(customized(GENERATED)); //defaults to true //$NON-NLS-1$
}
+
public void setGenerated(boolean value) {
setCustomizedBoolean(GENERATED, value, true);
}
/*get/set and field scopes*/
- public static final String PUBLIC_SCOPE = "public";
- public static final String PROTECTED_SCOPE = "protected";
- public static final String PRIVATE_SCOPE = "private";
+ public static final String PUBLIC_SCOPE = "public"; //$NON-NLS-1$
+ public static final String PROTECTED_SCOPE = "protected"; //$NON-NLS-1$
+ public static final String PRIVATE_SCOPE = "private"; //$NON-NLS-1$
/*customization properties*/
- private static final String PROPERTY_NAME = "propertyName";
- protected static final String PROPERTY_TYPE = "propertyType";
- protected static final String MAPPING_KIND = "mappingKind";
- private static final String PROPERTY_DESC = "propertyDesc";
- private static final String PROPERTY_GET_SCOPE = "propertyGetScope";
- private static final String PROPERTY_SET_SCOPE = "propertySetScope";
- private static final String FIELD_SCOPE = "fieldScope";
- private static final String USE_IN_EQUALS = "useInEquals";
- private static final String USE_IN_TO_STRING = "useInToString";
- private static final String UPDATEABLE = "updateable";
- private static final String INSERTABLE = "insertable";
- private static final String GENERATED = "genProperty";
+ private static final String PROPERTY_NAME = "propertyName"; //$NON-NLS-1$
+ protected static final String PROPERTY_TYPE = "propertyType"; //$NON-NLS-1$
+ protected static final String MAPPING_KIND = "mappingKind"; //$NON-NLS-1$
+ private static final String PROPERTY_DESC = "propertyDesc"; //$NON-NLS-1$
+ private static final String PROPERTY_GET_SCOPE = "propertyGetScope"; //$NON-NLS-1$
+ private static final String PROPERTY_SET_SCOPE = "propertySetScope"; //$NON-NLS-1$
+ private static final String FIELD_SCOPE = "fieldScope"; //$NON-NLS-1$
+ private static final String USE_IN_EQUALS = "useInEquals"; //$NON-NLS-1$
+ private static final String USE_IN_TO_STRING = "useInToString"; //$NON-NLS-1$
+ private static final String UPDATEABLE = "updateable"; //$NON-NLS-1$
+ private static final String INSERTABLE = "insertable"; //$NON-NLS-1$
+ private static final String GENERATED = "genProperty"; //$NON-NLS-1$
}
diff --git a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal2/ORMGenTable.java b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal2/ORMGenTable.java
index 885092a772..b7e03fe433 100644
--- a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal2/ORMGenTable.java
+++ b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal2/ORMGenTable.java
@@ -11,9 +11,13 @@ package org.eclipse.jpt.gen.internal2;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+
import org.eclipse.jpt.db.Column;
import org.eclipse.jpt.db.Table;
import org.eclipse.jpt.gen.internal.EntityGenTools;
@@ -35,7 +39,7 @@ public class ORMGenTable
private ORMGenCustomizer mCustomizer;
private List<ORMGenColumn> mColumns;
private Table mDbTable;
-
+ private HashMap<String, String> columnTypesMap = null;
/**
* @param table
* The database table or null if this table is used to get/set
@@ -114,31 +118,109 @@ public class ORMGenTable
return schemaName;
}
- /**
- * Sets the source folder for the generated class
- */
public void setSourceFolder(String srcFolder){
setCustomized(SRC_FOLDER, srcFolder);
}
+
public String getSourceFolder(){
String srcFolder = customized(SRC_FOLDER);
- return srcFolder==null?"":srcFolder;
+ return srcFolder == null ? "" : srcFolder;
+ }
+
+ public String getImportStatements(){
+ buildColumnTypesMap();
+ Collection<String> packages = columnTypesMap.keySet();
+ StringBuilder ret = new StringBuilder();
+ for ( String s : packages ) {
+ ret.append( "import " + s + ";\n"); //$NON-NLS-1$
+ }
+
+ List<AssociationRole> associationRoles = getAssociationRoles();
+ for ( AssociationRole role : associationRoles ) {
+ if ( role.getCardinality().equals( Association.ONE_TO_MANY )
+ || role.getCardinality().equals( Association.MANY_TO_MANY ) ) {
+ ret.append( "import " + getDefaultCollectionType() + ";\n"); //$NON-NLS-1$
+ break;
+ }
+ }
+
+ return ret.toString();
+ }
+
+ /**
+ * Construct import statements for types from javax.persistence package
+ * @return
+ */
+ private String getJavaxPersistenceImportStatements() {
+ StringBuilder ret = new StringBuilder();
+ ret.append( "import javax.persistence.Entity;\n"); //$NON-NLS-1$
+ //TODO: only if @Columns is needed
+ ret.append( "import javax.persistence.Column;\n");//$NON-NLS-1$
+ //TODO: only if there is @Id
+ ret.append( "import javax.persistence.Id;\n");//$NON-NLS-1$
+ if( !this.isDefaultname() )
+ ret.append( "import javax.persistence.Table;\n");//$NON-NLS-1$
+ if( this.isCompositeKey() )
+ ret.append( "import javax.persistence.EmbeddedId;\n"); //$NON-NLS-1$
+ // append javax.persistence package imports
+ HashSet<String> jpaImports = new HashSet<String>();
+ List<AssociationRole> associationRoles = getAssociationRoles();
+ for( AssociationRole role : associationRoles ){
+ if( role.getCardinality().equals( Association.ONE_TO_ONE ) ){
+ jpaImports.add( "import javax.persistence.OneToOne;" );//$NON-NLS-1$
+ }else{
+ if( role.getCardinality().equals( Association.ONE_TO_MANY ) ){
+ jpaImports.add( "import javax.persistence.OneToMany;\n" );//$NON-NLS-1$
+ }else if( role.getCardinality().equals( Association.MANY_TO_ONE ) ){
+ jpaImports.add( "import javax.persistence.ManyToOne;\n" );//$NON-NLS-1$
+ jpaImports.add( "import javax.persistence.JoinColumn;\n" ); //$NON-NLS-1$
+ }else if( role.getCardinality().equals( Association.MANY_TO_MANY ) ){
+ jpaImports.add( "import javax.persistence.ManyToMany;\n" );//$NON-NLS-1$
+ jpaImports.add( "import javax.persistence.JoinTable;\n" );//$NON-NLS-1$
+ jpaImports.add( "import javax.persistence.JoinColumns;\n");//$NON-NLS-1$
+ jpaImports.add( "import javax.persistence.JoinColumn;\n" );//$NON-NLS-1$
+ }
+ }
+ }
+ for( String s: jpaImports){
+ ret.append(s);
+ }
+ return ret.toString();
}
+
+ public HashMap<String, String> buildColumnTypesMap(){
+ if ( columnTypesMap != null) {
+ return columnTypesMap;
+ }
+ columnTypesMap = new HashMap<String, String>();
+ for ( ORMGenColumn col : this.getColumns() ) {
+ String type = col.getPropertyType();
+ if ( !col.isPartOfCompositePrimaryKey()
+ && !col.isForeignKey()
+ && !type.startsWith("java.lang") && type.indexOf('.')>0 ) {
+ String simpleType= type.substring( type.lastIndexOf('.')+1 );
+ columnTypesMap.put(type, simpleType);
+ }
+ }
+ return columnTypesMap;
+ }
+
+ public String getSimplifiedColType(String fqtn ) {
+ HashMap<String, String> map = buildColumnTypesMap();
+ String typeName = map.get(fqtn);
+ if ( typeName != null ) {
+ return typeName;
+ }
+ return fqtn;
+ }
+
/**
* Sets the package for the generated class (empty string for the default
* package)
*/
public void setPackage(String pkg) {
- getCustomizer().setProperty(PACKAGE, pkg, getName(), null); // not
- // calling
- // setCustomized
- // so that
- // empty
- // strings
- // do not
- // get
- // nulled
- // out.
+ getCustomizer().setProperty(PACKAGE, pkg, getName(), null);
+ // not calling setCustomized so that empty strings do not get nulled out.
}
/**
@@ -146,7 +228,7 @@ public class ORMGenTable
*/
public String getPackage() {
String packageName = customized(PACKAGE);
- return packageName == null ? "" : packageName;
+ return packageName == null ? "" : packageName; //$NON-NLS-1$
}
/**
@@ -234,6 +316,7 @@ public class ORMGenTable
while (cols.hasNext()) {
Column c = cols.next();
ORMGenColumn genColumn = getCustomizer().createGenColumn(c);
+ genColumn.setGenTable(this);
mColumns.add(genColumn);
}
}
@@ -326,7 +409,7 @@ public class ORMGenTable
if (column.isPrimaryKey()) {
if (!includePk || isCompositeKey()) {
continue;
- }else{
+ } else {
result.add(0, column);
continue;
}
@@ -668,6 +751,11 @@ public class ORMGenTable
}
return cType;
}
+
+ public String getSimpleCollectionType(){
+ String type = getDefaultCollectionType();
+ return type.substring( type.lastIndexOf('.') +1 );
+ }
public void setDefaultCollectionType(String cType) {
assert (cType.equals(LIST_COLLECTION_TYPE) || cType.equals(SET_COLLECTION_TYPE));
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 f52a4b7178..8e211d3584 100644
--- a/jpa/plugins/org.eclipse.jpt.gen/templates/entities/join.vm
+++ b/jpa/plugins/org.eclipse.jpt.gen/templates/entities/join.vm
@@ -26,9 +26,6 @@
#set ($joinTable = $role.association.joinTable)
@JoinTable(
name="${joinTable.joinTableAnnotationName}"
-#if ($joinTable.schema!="")
- , schema="${joinTable.schema}"
-#end
, joinColumns={
#foreach ($column in $role.referrerColumns)
#set ($referencedColumn = $role.getReferencedColumn(${column.name}))
diff --git a/jpa/plugins/org.eclipse.jpt.gen/templates/entities/main.java.vm b/jpa/plugins/org.eclipse.jpt.gen/templates/entities/main.java.vm
index d9e399aadd..6f50a76f48 100644
--- a/jpa/plugins/org.eclipse.jpt.gen/templates/entities/main.java.vm
+++ b/jpa/plugins/org.eclipse.jpt.gen/templates/entities/main.java.vm
@@ -4,6 +4,7 @@ package ${table.package};
import java.io.Serializable;
import javax.persistence.*;
+${table.importStatements}
/**
* The persistent class for the ${table.name} database table.
@@ -31,7 +32,7 @@ public class ${table.className} ${table.generateExtendsImplements()} {
#parse("mappingKind.vm")
#parse("column.vm")
#end
- ${column.fieldScope} ${column.propertyType} ${column.propertyName};
+ ${column.fieldScope} ${column.simplePropertyType} ${column.propertyName};
#end
#foreach ($role in $table.associationRoles)
#####
@@ -56,7 +57,7 @@ public class ${table.className} ${table.generateExtendsImplements()} {
#if ($role.cardinality == "many-to-one" || $role.cardinality == "one-to-one")
#set ($propertyType = ${role.referencedTable.className})
#elseif ($role.cardinality == "many-to-many" || $role.cardinality == "one-to-many")
-#set ($propertyType = "${role.referencedTable.defaultCollectionType}<${role.referencedTable.className}>")
+#set ($propertyType = "${role.referencedTable.simpleCollectionType}<${role.referencedTable.className}>")
#end
private $propertyType $role.propertyName;
#end
@@ -69,6 +70,7 @@ public class ${table.className} ${table.generateExtendsImplements()} {
#####
#if ($table.compositeKey)
#if ($table.access == "property")
+
@EmbeddedId
#end
public $table.compositeKeyClassName $customizer.propertyGetter($table.compositeKeyPropertyName)() {
@@ -82,14 +84,15 @@ public class ${table.className} ${table.generateExtendsImplements()} {
#end
#foreach ($column in $table.getSimpleColumns(true, true, false))
#if ($table.access == "property")
+
#parse("mappingKind.vm")
#parse("column.vm")
#end
- $column.propertyGetScope $column.propertyType $customizer.propertyGetter($column.propertyName)() {
+ $column.propertyGetScope $column.simplePropertyType $customizer.propertyGetter($column.propertyName)() {
return this.${column.propertyName};
}
- $column.propertySetScope void $customizer.propertySetter($column.propertyName)($column.propertyType $column.propertyName) {
+ $column.propertySetScope void $customizer.propertySetter($column.propertyName)($column.simplePropertyType $column.propertyName) {
this.${column.propertyName} = ${column.propertyName};
}
@@ -99,6 +102,7 @@ public class ${table.className} ${table.generateExtendsImplements()} {
#####
#foreach ($role in $table.associationRoles)
#if ($table.access == "property")
+
//${role.description}
#if ($role.cardinality == "many-to-one")
#parse("manyToOne.vm")
@@ -114,7 +118,7 @@ public class ${table.className} ${table.generateExtendsImplements()} {
#if ($role.cardinality == "many-to-one" || $role.cardinality == "one-to-one")
#set ($propertyType = $role.referencedTable.className)
#elseif ($role.cardinality == "many-to-many" || $role.cardinality == "one-to-many")
-#set ($propertyType = "${role.referencedTable.defaultCollectionType}<${role.referencedTable.className}>")
+#set ($propertyType = "${role.referencedTable.simpleCollectionType}<${role.referencedTable.className}>")
#end
public $propertyType $customizer.propertyGetter($role.propertyName)() {
return this.${role.propertyName};

Back to the top