columns, boolean oneToOne) {
String[] cols = new String[columns.size()];
for (int i = 0; i < columns.size(); i++) {
cols[i] = columns.get(i).getName();
}
- addCompoundUniqueConstraint(cols);
+ addCompoundUniqueConstraint(cols, oneToOne);
}
public void addForeignKey(MCompoundForeignKey compoundKey) {
diff --git a/src/main/java/com/avaje/ebean/dbmigration/model/build/ModelBuildBeanVisitor.java b/src/main/java/com/avaje/ebean/dbmigration/model/build/ModelBuildBeanVisitor.java
index 34692b244..667d9fb98 100644
--- a/src/main/java/com/avaje/ebean/dbmigration/model/build/ModelBuildBeanVisitor.java
+++ b/src/main/java/com/avaje/ebean/dbmigration/model/build/ModelBuildBeanVisitor.java
@@ -3,34 +3,30 @@ package com.avaje.ebean.dbmigration.model.build;
import com.avaje.ebean.config.dbplatform.DbType;
import com.avaje.ebean.config.dbplatform.IdType;
import com.avaje.ebean.dbmigration.migration.IdentityType;
-import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
-import com.avaje.ebeaninternal.server.deploy.BeanProperty;
-import com.avaje.ebeaninternal.server.deploy.CompoundUniqueContraint;
-import com.avaje.ebeaninternal.server.deploy.InheritInfo;
import com.avaje.ebean.dbmigration.model.MColumn;
import com.avaje.ebean.dbmigration.model.MTable;
import com.avaje.ebean.dbmigration.model.visitor.BeanPropertyVisitor;
import com.avaje.ebean.dbmigration.model.visitor.BeanVisitor;
-import com.avaje.ebeaninternal.server.type.ScalarType;
-
-import java.sql.Types;
+import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
+import com.avaje.ebeaninternal.server.deploy.CompoundUniqueContraint;
+import com.avaje.ebeaninternal.server.deploy.InheritInfo;
/**
* Used to build the Model objects MTable etc.
*/
public class ModelBuildBeanVisitor implements BeanVisitor {
- private final ModelBuildContext ctx;
+ private final ModelBuildContext ctx;
- public ModelBuildBeanVisitor(ModelBuildContext ctx) {
- this.ctx = ctx;
- }
+ public ModelBuildBeanVisitor(ModelBuildContext ctx) {
+ this.ctx = ctx;
+ }
/**
* Return the PropertyVisitor used to read all the property meta data
* and in this case add MColumn objects to the model.
*
- * This creates an MTable and adds it to the model.
+ * This creates an MTable and adds it to the model.
*
*/
public BeanPropertyVisitor visitBean(BeanDescriptor> descriptor) {
@@ -59,7 +55,7 @@ public class ModelBuildBeanVisitor implements BeanVisitor {
CompoundUniqueContraint[] compoundUniqueConstraints = descriptor.getCompoundUniqueConstraints();
if (compoundUniqueConstraints != null) {
for (int i = 0; i < compoundUniqueConstraints.length; i++) {
- table.addCompoundUniqueConstraint(compoundUniqueConstraints[i].getColumns());
+ table.addCompoundUniqueConstraint(compoundUniqueConstraints[i].getColumns(), false);
}
}
@@ -68,7 +64,6 @@ public class ModelBuildBeanVisitor implements BeanVisitor {
private void setIdentity(BeanDescriptor> descriptor, MTable table) {
-
if (IdType.GENERATOR == descriptor.getIdType()) {
// explicit generator like UUID
table.setIdentityType(IdentityType.GENERATOR);
@@ -94,20 +89,7 @@ public class ModelBuildBeanVisitor implements BeanVisitor {
table.setSequenceInitial(initialValue);
table.setSequenceAllocate(allocationSize);
}
- return;
}
-
- BeanProperty idProperty = descriptor.getIdProperty();
- if (idProperty != null) {
- ScalarType