[jOOQ/jOOQ#2530] Added qualification support for embeddables
This commit is contained in:
parent
80e81e89aa
commit
79396e3cc4
@ -1901,6 +1901,15 @@ public abstract class AbstractDatabase implements Database {
|
||||
|
||||
|
||||
if (columns.size() == embeddable.getFields().size()) {
|
||||
CatalogDefinition catalog = getCatalog(embeddable.getCatalog());
|
||||
|
||||
SchemaDefinition schema = catalog != null
|
||||
? catalog.getSchema(embeddable.getSchema())
|
||||
: getSchema(embeddable.getSchema());
|
||||
|
||||
if (schema == null)
|
||||
schema = table.getSchema();
|
||||
|
||||
Name name = table.getQualifiedNamePart().append(embeddable.getName());
|
||||
|
||||
if (result.containsKey(name))
|
||||
@ -1909,6 +1918,7 @@ public abstract class AbstractDatabase implements Database {
|
||||
result.put(
|
||||
name,
|
||||
new DefaultEmbeddableDefinition(
|
||||
schema,
|
||||
embeddable.getName(),
|
||||
table,
|
||||
names,
|
||||
@ -1988,6 +1998,8 @@ public abstract class AbstractDatabase implements Database {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -60,6 +60,7 @@ public class DefaultEmbeddableDefinition
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public DefaultEmbeddableDefinition(
|
||||
SchemaDefinition definingSchema,
|
||||
String definingName,
|
||||
TableDefinition definingTable,
|
||||
List<String> definingColumnNames,
|
||||
@ -68,7 +69,7 @@ public class DefaultEmbeddableDefinition
|
||||
List<ColumnDefinition> referencingColumns,
|
||||
boolean replacesFields
|
||||
) {
|
||||
super(definingTable.getSchema(), definingName, "");
|
||||
super(definingSchema, definingName, "");
|
||||
|
||||
this.definingColumnNames = definingColumnNames;
|
||||
this.definingTable = definingTable;
|
||||
|
||||
@ -34,6 +34,10 @@ public class Embeddable implements Serializable, XMLAppendable
|
||||
|
||||
private final static long serialVersionUID = 31400L;
|
||||
@XmlJavaTypeAdapter(StringAdapter.class)
|
||||
protected String catalog;
|
||||
@XmlJavaTypeAdapter(StringAdapter.class)
|
||||
protected String schema;
|
||||
@XmlJavaTypeAdapter(StringAdapter.class)
|
||||
protected String name;
|
||||
@XmlJavaTypeAdapter(StringAdapter.class)
|
||||
protected String referencingName;
|
||||
@ -45,6 +49,38 @@ public class Embeddable implements Serializable, XMLAppendable
|
||||
@XmlElement(name = "field")
|
||||
protected List<EmbeddableField> fields;
|
||||
|
||||
/**
|
||||
* The defining catalog of the embeddable type, or the catalog of the first matched table if left empty.
|
||||
*
|
||||
*/
|
||||
public String getCatalog() {
|
||||
return catalog;
|
||||
}
|
||||
|
||||
/**
|
||||
* The defining catalog of the embeddable type, or the catalog of the first matched table if left empty.
|
||||
*
|
||||
*/
|
||||
public void setCatalog(String value) {
|
||||
this.catalog = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The defining schema of the embeddable type, or the schema of the first matched table if left empty.
|
||||
*
|
||||
*/
|
||||
public String getSchema() {
|
||||
return schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* The defining schema of the embeddable type, or the schema of the first matched table if left empty.
|
||||
*
|
||||
*/
|
||||
public void setSchema(String value) {
|
||||
this.schema = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The defining name of the embeddable type.
|
||||
*
|
||||
@ -128,6 +164,24 @@ public class Embeddable implements Serializable, XMLAppendable
|
||||
this.fields = fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* The defining catalog of the embeddable type, or the catalog of the first matched table if left empty.
|
||||
*
|
||||
*/
|
||||
public Embeddable withCatalog(String value) {
|
||||
setCatalog(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The defining schema of the embeddable type, or the schema of the first matched table if left empty.
|
||||
*
|
||||
*/
|
||||
public Embeddable withSchema(String value) {
|
||||
setSchema(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The defining name of the embeddable type.
|
||||
*
|
||||
@ -183,6 +237,8 @@ public class Embeddable implements Serializable, XMLAppendable
|
||||
|
||||
@Override
|
||||
public final void appendTo(XMLBuilder builder) {
|
||||
builder.append("catalog", catalog);
|
||||
builder.append("schema", schema);
|
||||
builder.append("name", name);
|
||||
builder.append("referencingName", referencingName);
|
||||
builder.append("tables", tables);
|
||||
@ -209,6 +265,24 @@ public class Embeddable implements Serializable, XMLAppendable
|
||||
return false;
|
||||
}
|
||||
Embeddable other = ((Embeddable) that);
|
||||
if (catalog == null) {
|
||||
if (other.catalog!= null) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!catalog.equals(other.catalog)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (schema == null) {
|
||||
if (other.schema!= null) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!schema.equals(other.schema)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (name == null) {
|
||||
if (other.name!= null) {
|
||||
return false;
|
||||
@ -261,6 +335,8 @@ public class Embeddable implements Serializable, XMLAppendable
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = ((prime*result)+((catalog == null)? 0 :catalog.hashCode()));
|
||||
result = ((prime*result)+((schema == null)? 0 :schema.hashCode()));
|
||||
result = ((prime*result)+((name == null)? 0 :name.hashCode()));
|
||||
result = ((prime*result)+((referencingName == null)? 0 :referencingName.hashCode()));
|
||||
result = ((prime*result)+((tables == null)? 0 :tables.hashCode()));
|
||||
|
||||
@ -1012,6 +1012,14 @@ for Oracle.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
<complexType name="Embeddable">
|
||||
<annotation><appinfo><jxb:class><jxb:javadoc><![CDATA[An embeddable type declaration]]></jxb:javadoc></jxb:class></appinfo></annotation>
|
||||
<all>
|
||||
<element name="catalog" type="string" minOccurs="0" maxOccurs="1">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[The defining catalog of the embeddable type, or the catalog of the first matched table if left empty.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="schema" type="string" minOccurs="0" maxOccurs="1">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[The defining schema of the embeddable type, or the schema of the first matched table if left empty.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="name" type="string" minOccurs="0" maxOccurs="1">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[The defining name of the embeddable type.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user