diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/AbstractDatabase.java b/jOOQ-meta/src/main/java/org/jooq/meta/AbstractDatabase.java
index 6e19bcc1c0..625be4c644 100644
--- a/jOOQ-meta/src/main/java/org/jooq/meta/AbstractDatabase.java
+++ b/jOOQ-meta/src/main/java/org/jooq/meta/AbstractDatabase.java
@@ -1198,7 +1198,7 @@ public abstract class AbstractDatabase implements Database {
for (String syntheticPrimaryKey : syntheticPrimaryKeys) {
if (!StringUtils.isBlank(syntheticPrimaryKey)) {
log.warn("DEPRECATION", "The configuration element has been deprecated in jOOQ 3.14. Use only, instead.");
- getConfiguredSyntheticPrimaryKeys().add(new SyntheticPrimaryKeyType().withKeyFields(syntheticPrimaryKey));
+ getConfiguredSyntheticPrimaryKeys().add(new SyntheticPrimaryKeyType().withFields(syntheticPrimaryKey));
}
}
}
@@ -1238,7 +1238,7 @@ public abstract class AbstractDatabase implements Database {
for (String syntheticIdentity : syntheticIdentities) {
if (!StringUtils.isBlank(syntheticIdentity)) {
log.warn("DEPRECATION", "The configuration element has been deprecated in jOOQ 3.14. Use only, instead.");
- getConfiguredSyntheticIdentities().add(new SyntheticIdentityType().withKeyFields(syntheticIdentity));
+ getConfiguredSyntheticIdentities().add(new SyntheticIdentityType().withFields(syntheticIdentity));
}
}
}
@@ -2603,6 +2603,15 @@ public abstract class AbstractDatabase implements Database {
return filterExcludeInclude(definitions, null, include);
}
+ protected final List filter(List definitions, List include) {
+ List result = new ArrayList<>();
+
+ for (String i : include)
+ result.addAll(filter(definitions, i));
+
+ return result;
+ }
+
protected final List filterExcludeInclude(List definitions, String e, String i) {
return filterExcludeInclude(definitions, new String[] { e }, new String[] { i != null ? i : ".*" }, Collections.emptyList());
}
@@ -2874,7 +2883,7 @@ public abstract class AbstractDatabase implements Database {
if (key.getKey() == null)
continue keyLoop;
- for (TableDefinition table : filter(getTables(), key.getKeyTables())) {
+ for (TableDefinition table : filter(getTables(), key.getTables())) {
for (UniqueKeyDefinition uk : filter(table.getUniqueKeys(), key.getKey())) {
log.info("Overriding primary key", "" + uk);
r.overridePrimaryKey(uk);
@@ -2891,10 +2900,10 @@ public abstract class AbstractDatabase implements Database {
if (key.getKey() != null)
continue keyLoop;
- for (TableDefinition table : filter(getTables(), key.getKeyTables())) {
+ for (TableDefinition table : filter(getTables(), key.getTables())) {
String keyName = key.getName() != null ? key.getName() : "SYNTHETIC_PK_" + table.getName();
- List columns = filter(table.getColumns(), key.getKeyFields());
+ List columns = filter(table.getColumns(), key.getFields());
if (!columns.isEmpty()) {
markUsed(key);
@@ -2963,7 +2972,6 @@ public abstract class AbstractDatabase implements Database {
-
@Override
diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/DefaultColumnDefinition.java b/jOOQ-meta/src/main/java/org/jooq/meta/DefaultColumnDefinition.java
index cdd1b44762..48e120b73c 100644
--- a/jOOQ-meta/src/main/java/org/jooq/meta/DefaultColumnDefinition.java
+++ b/jOOQ-meta/src/main/java/org/jooq/meta/DefaultColumnDefinition.java
@@ -78,8 +78,8 @@ public class DefaultColumnDefinition
AbstractDatabase db = (AbstractDatabase) column.getDatabase();
for (SyntheticIdentityType id : db.getConfiguredSyntheticIdentities()) {
- for (TableDefinition t : db.filter(singletonList(column.getContainer()), id.getKeyTables())) {
- for (ColumnDefinition c : db.filter(singletonList(column), id.getKeyFields())) {
+ for (TableDefinition t : db.filter(singletonList(column.getContainer()), id.getTables())) {
+ for (ColumnDefinition c : db.filter(singletonList(column), id.getFields())) {
log.info("Synthetic identity", column.getQualifiedName());
db.markUsed(id);
return true;
diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticForeignKeyType.java b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticForeignKeyType.java
index 3184aba223..6e51eeb243 100644
--- a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticForeignKeyType.java
+++ b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticForeignKeyType.java
@@ -2,9 +2,13 @@
package org.jooq.meta.jaxb;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.jooq.util.jaxb.tools.StringAdapter;
@@ -23,10 +27,10 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <all>
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="keyTables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="keyFields" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="tables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="fields" type="{http://www.jooq.org/xsd/jooq-codegen-3.13.0.xsd}SyntheticKeyFieldsType"/>
* <element name="referencedTable" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="referencedFields" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="referencedFields" type="{http://www.jooq.org/xsd/jooq-codegen-3.13.0.xsd}SyntheticKeyFieldsType" minOccurs="0"/>
* <element name="referencedKey" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </all>
* </restriction>
@@ -50,17 +54,18 @@ public class SyntheticForeignKeyType implements Serializable, XMLAppendable
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;
@XmlJavaTypeAdapter(StringAdapter.class)
- protected String keyTables;
- @XmlElement(required = true)
- @XmlJavaTypeAdapter(StringAdapter.class)
- protected String keyFields;
+ protected String tables;
@XmlElement(required = true)
@XmlJavaTypeAdapter(StringAdapter.class)
protected String referencedTable;
@XmlJavaTypeAdapter(StringAdapter.class)
- protected String referencedFields;
- @XmlJavaTypeAdapter(StringAdapter.class)
protected String referencedKey;
+ @XmlElementWrapper(name = "fields", required = true)
+ @XmlElement(name = "field")
+ protected List fields;
+ @XmlElementWrapper(name = "referencedFields")
+ @XmlElement(name = "field")
+ protected List referencedFields;
/**
* The optional foreign key name.
@@ -82,32 +87,16 @@ public class SyntheticForeignKeyType implements Serializable, XMLAppendable
* A regular expression matching all tables on which to apply this synthetic foreign key.
*
*/
- public String getKeyTables() {
- return keyTables;
+ public String getTables() {
+ return tables;
}
/**
* A regular expression matching all tables on which to apply this synthetic foreign key.
*
*/
- public void setKeyTables(String value) {
- this.keyTables = value;
- }
-
- /**
- * A regular expression matching all fields on which to apply this synthetic foreign key.
- *
- */
- public String getKeyFields() {
- return keyFields;
- }
-
- /**
- * A regular expression matching all fields on which to apply this synthetic foreign key.
- *
- */
- public void setKeyFields(String value) {
- this.keyFields = value;
+ public void setTables(String value) {
+ this.tables = value;
}
/**
@@ -126,22 +115,6 @@ public class SyntheticForeignKeyType implements Serializable, XMLAppendable
this.referencedTable = value;
}
- /**
- * A regular expression matching fields that are referenced by this synthetic foreign key.
- *
- */
- public String getReferencedFields() {
- return referencedFields;
- }
-
- /**
- * A regular expression matching fields that are referenced by this synthetic foreign key.
- *
- */
- public void setReferencedFields(String value) {
- this.referencedFields = value;
- }
-
/**
* A regular expression matching a key that is referenced by this synthetic foreign key.
*
@@ -158,6 +131,28 @@ public class SyntheticForeignKeyType implements Serializable, XMLAppendable
this.referencedKey = value;
}
+ public List getFields() {
+ if (fields == null) {
+ fields = new ArrayList();
+ }
+ return fields;
+ }
+
+ public void setFields(List fields) {
+ this.fields = fields;
+ }
+
+ public List getReferencedFields() {
+ if (referencedFields == null) {
+ referencedFields = new ArrayList();
+ }
+ return referencedFields;
+ }
+
+ public void setReferencedFields(List referencedFields) {
+ this.referencedFields = referencedFields;
+ }
+
/**
* The optional foreign key name.
*
@@ -171,17 +166,8 @@ public class SyntheticForeignKeyType implements Serializable, XMLAppendable
* A regular expression matching all tables on which to apply this synthetic foreign key.
*
*/
- public SyntheticForeignKeyType withKeyTables(String value) {
- setKeyTables(value);
- return this;
- }
-
- /**
- * A regular expression matching all fields on which to apply this synthetic foreign key.
- *
- */
- public SyntheticForeignKeyType withKeyFields(String value) {
- setKeyFields(value);
+ public SyntheticForeignKeyType withTables(String value) {
+ setTables(value);
return this;
}
@@ -194,15 +180,6 @@ public class SyntheticForeignKeyType implements Serializable, XMLAppendable
return this;
}
- /**
- * A regular expression matching fields that are referenced by this synthetic foreign key.
- *
- */
- public SyntheticForeignKeyType withReferencedFields(String value) {
- setReferencedFields(value);
- return this;
- }
-
/**
* A regular expression matching a key that is referenced by this synthetic foreign key.
*
@@ -212,14 +189,56 @@ public class SyntheticForeignKeyType implements Serializable, XMLAppendable
return this;
}
+ public SyntheticForeignKeyType withFields(String... values) {
+ if (values!= null) {
+ for (String value: values) {
+ getFields().add(value);
+ }
+ }
+ return this;
+ }
+
+ public SyntheticForeignKeyType withFields(Collection values) {
+ if (values!= null) {
+ getFields().addAll(values);
+ }
+ return this;
+ }
+
+ public SyntheticForeignKeyType withFields(List fields) {
+ setFields(fields);
+ return this;
+ }
+
+ public SyntheticForeignKeyType withReferencedFields(String... values) {
+ if (values!= null) {
+ for (String value: values) {
+ getReferencedFields().add(value);
+ }
+ }
+ return this;
+ }
+
+ public SyntheticForeignKeyType withReferencedFields(Collection values) {
+ if (values!= null) {
+ getReferencedFields().addAll(values);
+ }
+ return this;
+ }
+
+ public SyntheticForeignKeyType withReferencedFields(List referencedFields) {
+ setReferencedFields(referencedFields);
+ return this;
+ }
+
@Override
public final void appendTo(XMLBuilder builder) {
builder.append("name", name);
- builder.append("keyTables", keyTables);
- builder.append("keyFields", keyFields);
+ builder.append("tables", tables);
builder.append("referencedTable", referencedTable);
- builder.append("referencedFields", referencedFields);
builder.append("referencedKey", referencedKey);
+ builder.append("fields", "field", fields);
+ builder.append("referencedFields", "field", referencedFields);
}
@Override
@@ -250,21 +269,12 @@ public class SyntheticForeignKeyType implements Serializable, XMLAppendable
return false;
}
}
- if (keyTables == null) {
- if (other.keyTables!= null) {
+ if (tables == null) {
+ if (other.tables!= null) {
return false;
}
} else {
- if (!keyTables.equals(other.keyTables)) {
- return false;
- }
- }
- if (keyFields == null) {
- if (other.keyFields!= null) {
- return false;
- }
- } else {
- if (!keyFields.equals(other.keyFields)) {
+ if (!tables.equals(other.tables)) {
return false;
}
}
@@ -277,15 +287,6 @@ public class SyntheticForeignKeyType implements Serializable, XMLAppendable
return false;
}
}
- if (referencedFields == null) {
- if (other.referencedFields!= null) {
- return false;
- }
- } else {
- if (!referencedFields.equals(other.referencedFields)) {
- return false;
- }
- }
if (referencedKey == null) {
if (other.referencedKey!= null) {
return false;
@@ -295,6 +296,24 @@ public class SyntheticForeignKeyType implements Serializable, XMLAppendable
return false;
}
}
+ if (fields == null) {
+ if (other.fields!= null) {
+ return false;
+ }
+ } else {
+ if (!fields.equals(other.fields)) {
+ return false;
+ }
+ }
+ if (referencedFields == null) {
+ if (other.referencedFields!= null) {
+ return false;
+ }
+ } else {
+ if (!referencedFields.equals(other.referencedFields)) {
+ return false;
+ }
+ }
return true;
}
@@ -303,11 +322,11 @@ public class SyntheticForeignKeyType implements Serializable, XMLAppendable
final int prime = 31;
int result = 1;
result = ((prime*result)+((name == null)? 0 :name.hashCode()));
- result = ((prime*result)+((keyTables == null)? 0 :keyTables.hashCode()));
- result = ((prime*result)+((keyFields == null)? 0 :keyFields.hashCode()));
+ result = ((prime*result)+((tables == null)? 0 :tables.hashCode()));
result = ((prime*result)+((referencedTable == null)? 0 :referencedTable.hashCode()));
- result = ((prime*result)+((referencedFields == null)? 0 :referencedFields.hashCode()));
result = ((prime*result)+((referencedKey == null)? 0 :referencedKey.hashCode()));
+ result = ((prime*result)+((fields == null)? 0 :fields.hashCode()));
+ result = ((prime*result)+((referencedFields == null)? 0 :referencedFields.hashCode()));
return result;
}
diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticIdentityType.java b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticIdentityType.java
index a1949cae89..f1e2ec3e81 100644
--- a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticIdentityType.java
+++ b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticIdentityType.java
@@ -22,8 +22,8 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <all>
- * <element name="keyTables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="keyFields" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="tables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="fields" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </all>
* </restriction>
* </complexContent>
@@ -44,49 +44,49 @@ public class SyntheticIdentityType implements Serializable, XMLAppendable
private final static long serialVersionUID = 31400L;
@XmlJavaTypeAdapter(StringAdapter.class)
- protected String keyTables;
+ protected String tables;
@XmlElement(required = true)
@XmlJavaTypeAdapter(StringAdapter.class)
- protected String keyFields;
+ protected String fields;
/**
* A regular expression matching all tables on which to apply this synthetic identity.
*
*/
- public String getKeyTables() {
- return keyTables;
+ public String getTables() {
+ return tables;
}
/**
* A regular expression matching all tables on which to apply this synthetic identity.
*
*/
- public void setKeyTables(String value) {
- this.keyTables = value;
+ public void setTables(String value) {
+ this.tables = value;
}
/**
* A regular expression matching all fields on which to apply this synthetic identity.
*
*/
- public String getKeyFields() {
- return keyFields;
+ public String getFields() {
+ return fields;
}
/**
* A regular expression matching all fields on which to apply this synthetic identity.
*
*/
- public void setKeyFields(String value) {
- this.keyFields = value;
+ public void setFields(String value) {
+ this.fields = value;
}
/**
* A regular expression matching all tables on which to apply this synthetic identity.
*
*/
- public SyntheticIdentityType withKeyTables(String value) {
- setKeyTables(value);
+ public SyntheticIdentityType withTables(String value) {
+ setTables(value);
return this;
}
@@ -94,15 +94,15 @@ public class SyntheticIdentityType implements Serializable, XMLAppendable
* A regular expression matching all fields on which to apply this synthetic identity.
*
*/
- public SyntheticIdentityType withKeyFields(String value) {
- setKeyFields(value);
+ public SyntheticIdentityType withFields(String value) {
+ setFields(value);
return this;
}
@Override
public final void appendTo(XMLBuilder builder) {
- builder.append("keyTables", keyTables);
- builder.append("keyFields", keyFields);
+ builder.append("tables", tables);
+ builder.append("fields", fields);
}
@Override
@@ -124,21 +124,21 @@ public class SyntheticIdentityType implements Serializable, XMLAppendable
return false;
}
SyntheticIdentityType other = ((SyntheticIdentityType) that);
- if (keyTables == null) {
- if (other.keyTables!= null) {
+ if (tables == null) {
+ if (other.tables!= null) {
return false;
}
} else {
- if (!keyTables.equals(other.keyTables)) {
+ if (!tables.equals(other.tables)) {
return false;
}
}
- if (keyFields == null) {
- if (other.keyFields!= null) {
+ if (fields == null) {
+ if (other.fields!= null) {
return false;
}
} else {
- if (!keyFields.equals(other.keyFields)) {
+ if (!fields.equals(other.fields)) {
return false;
}
}
@@ -149,8 +149,8 @@ public class SyntheticIdentityType implements Serializable, XMLAppendable
public int hashCode() {
final int prime = 31;
int result = 1;
- result = ((prime*result)+((keyTables == null)? 0 :keyTables.hashCode()));
- result = ((prime*result)+((keyFields == null)? 0 :keyFields.hashCode()));
+ result = ((prime*result)+((tables == null)? 0 :tables.hashCode()));
+ result = ((prime*result)+((fields == null)? 0 :fields.hashCode()));
return result;
}
diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticPrimaryKeyType.java b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticPrimaryKeyType.java
index e5d6587142..923f2d8460 100644
--- a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticPrimaryKeyType.java
+++ b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticPrimaryKeyType.java
@@ -2,9 +2,13 @@
package org.jooq.meta.jaxb;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.jooq.util.jaxb.tools.StringAdapter;
@@ -23,8 +27,8 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <all>
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="keyTables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="keyFields" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="tables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="fields" type="{http://www.jooq.org/xsd/jooq-codegen-3.13.0.xsd}SyntheticKeyFieldsType"/>
* <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </all>
* </restriction>
@@ -48,12 +52,12 @@ public class SyntheticPrimaryKeyType implements Serializable, XMLAppendable
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;
@XmlJavaTypeAdapter(StringAdapter.class)
- protected String keyTables;
- @XmlElement(required = true)
- @XmlJavaTypeAdapter(StringAdapter.class)
- protected String keyFields;
+ protected String tables;
@XmlJavaTypeAdapter(StringAdapter.class)
protected String key;
+ @XmlElementWrapper(name = "fields", required = true)
+ @XmlElement(name = "field")
+ protected List fields;
/**
* The optional primary key name.
@@ -75,32 +79,16 @@ public class SyntheticPrimaryKeyType implements Serializable, XMLAppendable
* A regular expression matching all tables on which to apply this synthetic primary key.
*
*/
- public String getKeyTables() {
- return keyTables;
+ public String getTables() {
+ return tables;
}
/**
* A regular expression matching all tables on which to apply this synthetic primary key.
*
*/
- public void setKeyTables(String value) {
- this.keyTables = value;
- }
-
- /**
- * A regular expression matching all fields on which to apply this new synthetic primary key.
- *
- */
- public String getKeyFields() {
- return keyFields;
- }
-
- /**
- * A regular expression matching all fields on which to apply this new synthetic primary key.
- *
- */
- public void setKeyFields(String value) {
- this.keyFields = value;
+ public void setTables(String value) {
+ this.tables = value;
}
/**
@@ -119,6 +107,17 @@ public class SyntheticPrimaryKeyType implements Serializable, XMLAppendable
this.key = value;
}
+ public List getFields() {
+ if (fields == null) {
+ fields = new ArrayList();
+ }
+ return fields;
+ }
+
+ public void setFields(List fields) {
+ this.fields = fields;
+ }
+
/**
* The optional primary key name.
*
@@ -132,17 +131,8 @@ public class SyntheticPrimaryKeyType implements Serializable, XMLAppendable
* A regular expression matching all tables on which to apply this synthetic primary key.
*
*/
- public SyntheticPrimaryKeyType withKeyTables(String value) {
- setKeyTables(value);
- return this;
- }
-
- /**
- * A regular expression matching all fields on which to apply this new synthetic primary key.
- *
- */
- public SyntheticPrimaryKeyType withKeyFields(String value) {
- setKeyFields(value);
+ public SyntheticPrimaryKeyType withTables(String value) {
+ setTables(value);
return this;
}
@@ -155,12 +145,33 @@ public class SyntheticPrimaryKeyType implements Serializable, XMLAppendable
return this;
}
+ public SyntheticPrimaryKeyType withFields(String... values) {
+ if (values!= null) {
+ for (String value: values) {
+ getFields().add(value);
+ }
+ }
+ return this;
+ }
+
+ public SyntheticPrimaryKeyType withFields(Collection values) {
+ if (values!= null) {
+ getFields().addAll(values);
+ }
+ return this;
+ }
+
+ public SyntheticPrimaryKeyType withFields(List fields) {
+ setFields(fields);
+ return this;
+ }
+
@Override
public final void appendTo(XMLBuilder builder) {
builder.append("name", name);
- builder.append("keyTables", keyTables);
- builder.append("keyFields", keyFields);
+ builder.append("tables", tables);
builder.append("key", key);
+ builder.append("fields", "field", fields);
}
@Override
@@ -191,21 +202,12 @@ public class SyntheticPrimaryKeyType implements Serializable, XMLAppendable
return false;
}
}
- if (keyTables == null) {
- if (other.keyTables!= null) {
+ if (tables == null) {
+ if (other.tables!= null) {
return false;
}
} else {
- if (!keyTables.equals(other.keyTables)) {
- return false;
- }
- }
- if (keyFields == null) {
- if (other.keyFields!= null) {
- return false;
- }
- } else {
- if (!keyFields.equals(other.keyFields)) {
+ if (!tables.equals(other.tables)) {
return false;
}
}
@@ -218,6 +220,15 @@ public class SyntheticPrimaryKeyType implements Serializable, XMLAppendable
return false;
}
}
+ if (fields == null) {
+ if (other.fields!= null) {
+ return false;
+ }
+ } else {
+ if (!fields.equals(other.fields)) {
+ return false;
+ }
+ }
return true;
}
@@ -226,9 +237,9 @@ public class SyntheticPrimaryKeyType implements Serializable, XMLAppendable
final int prime = 31;
int result = 1;
result = ((prime*result)+((name == null)? 0 :name.hashCode()));
- result = ((prime*result)+((keyTables == null)? 0 :keyTables.hashCode()));
- result = ((prime*result)+((keyFields == null)? 0 :keyFields.hashCode()));
+ result = ((prime*result)+((tables == null)? 0 :tables.hashCode()));
result = ((prime*result)+((key == null)? 0 :key.hashCode()));
+ result = ((prime*result)+((fields == null)? 0 :fields.hashCode()));
return result;
}
diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticUniqueKeyType.java b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticUniqueKeyType.java
index f591c346aa..a94fa6edbf 100644
--- a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticUniqueKeyType.java
+++ b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/SyntheticUniqueKeyType.java
@@ -2,9 +2,13 @@
package org.jooq.meta.jaxb;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.jooq.util.jaxb.tools.StringAdapter;
@@ -23,8 +27,8 @@ import org.jooq.util.jaxb.tools.XMLBuilder;
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <all>
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="keyTables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="keyFields" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="tables" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="fields" type="{http://www.jooq.org/xsd/jooq-codegen-3.13.0.xsd}SyntheticKeyFieldsType"/>
* </all>
* </restriction>
* </complexContent>
@@ -47,10 +51,10 @@ public class SyntheticUniqueKeyType implements Serializable, XMLAppendable
@XmlJavaTypeAdapter(StringAdapter.class)
protected String name;
@XmlJavaTypeAdapter(StringAdapter.class)
- protected String keyTables;
- @XmlElement(required = true)
- @XmlJavaTypeAdapter(StringAdapter.class)
- protected String keyFields;
+ protected String tables;
+ @XmlElementWrapper(name = "fields", required = true)
+ @XmlElement(name = "field")
+ protected List fields;
/**
* The optional unique key name.
@@ -72,32 +76,27 @@ public class SyntheticUniqueKeyType implements Serializable, XMLAppendable
* A regular expression matching all tables on which to apply this synthetic unique key.
*
*/
- public String getKeyTables() {
- return keyTables;
+ public String getTables() {
+ return tables;
}
/**
* A regular expression matching all tables on which to apply this synthetic unique key.
*
*/
- public void setKeyTables(String value) {
- this.keyTables = value;
+ public void setTables(String value) {
+ this.tables = value;
}
- /**
- * A regular expression matching all fields on which to apply this synthetic unique key.
- *
- */
- public String getKeyFields() {
- return keyFields;
+ public List getFields() {
+ if (fields == null) {
+ fields = new ArrayList();
+ }
+ return fields;
}
- /**
- * A regular expression matching all fields on which to apply this synthetic unique key.
- *
- */
- public void setKeyFields(String value) {
- this.keyFields = value;
+ public void setFields(List fields) {
+ this.fields = fields;
}
/**
@@ -113,25 +112,37 @@ public class SyntheticUniqueKeyType implements Serializable, XMLAppendable
* A regular expression matching all tables on which to apply this synthetic unique key.
*
*/
- public SyntheticUniqueKeyType withKeyTables(String value) {
- setKeyTables(value);
+ public SyntheticUniqueKeyType withTables(String value) {
+ setTables(value);
return this;
}
- /**
- * A regular expression matching all fields on which to apply this synthetic unique key.
- *
- */
- public SyntheticUniqueKeyType withKeyFields(String value) {
- setKeyFields(value);
+ public SyntheticUniqueKeyType withFields(String... values) {
+ if (values!= null) {
+ for (String value: values) {
+ getFields().add(value);
+ }
+ }
+ return this;
+ }
+
+ public SyntheticUniqueKeyType withFields(Collection values) {
+ if (values!= null) {
+ getFields().addAll(values);
+ }
+ return this;
+ }
+
+ public SyntheticUniqueKeyType withFields(List fields) {
+ setFields(fields);
return this;
}
@Override
public final void appendTo(XMLBuilder builder) {
builder.append("name", name);
- builder.append("keyTables", keyTables);
- builder.append("keyFields", keyFields);
+ builder.append("tables", tables);
+ builder.append("fields", "field", fields);
}
@Override
@@ -162,21 +173,21 @@ public class SyntheticUniqueKeyType implements Serializable, XMLAppendable
return false;
}
}
- if (keyTables == null) {
- if (other.keyTables!= null) {
+ if (tables == null) {
+ if (other.tables!= null) {
return false;
}
} else {
- if (!keyTables.equals(other.keyTables)) {
+ if (!tables.equals(other.tables)) {
return false;
}
}
- if (keyFields == null) {
- if (other.keyFields!= null) {
+ if (fields == null) {
+ if (other.fields!= null) {
return false;
}
} else {
- if (!keyFields.equals(other.keyFields)) {
+ if (!fields.equals(other.fields)) {
return false;
}
}
@@ -188,8 +199,8 @@ public class SyntheticUniqueKeyType implements Serializable, XMLAppendable
final int prime = 31;
int result = 1;
result = ((prime*result)+((name == null)? 0 :name.hashCode()));
- result = ((prime*result)+((keyTables == null)? 0 :keyTables.hashCode()));
- result = ((prime*result)+((keyFields == null)? 0 :keyFields.hashCode()));
+ result = ((prime*result)+((tables == null)? 0 :tables.hashCode()));
+ result = ((prime*result)+((fields == null)? 0 :fields.hashCode()));
return result;
}
diff --git a/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.14.0.xsd b/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.14.0.xsd
index 65b9fa2a84..23c089833b 100644
--- a/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.14.0.xsd
+++ b/jOOQ-meta/src/main/resources/xsd/jooq-codegen-3.14.0.xsd
@@ -945,11 +945,11 @@ for Oracle.]]>
-
+
-
+
@@ -968,12 +968,12 @@ for Oracle.]]>
-
+
-
-
+
+
@@ -995,12 +995,12 @@ for Oracle.]]>
-
+
-
-
+
+
@@ -1018,20 +1018,20 @@ for Oracle.]]>
-
+
-
-
+
+
-
-
+
+
@@ -1039,7 +1039,15 @@ for Oracle.]]>
-
+
+
+
+
+
+
+
+
+