HHH-9882 - many to one declarations in hbm without embed-xml="false" generate warning

This commit is contained in:
Steve Ebersole 2015-07-31 16:32:51 -05:00
parent fa14d4fb70
commit 02002169ef
8 changed files with 42 additions and 51 deletions

View File

@ -227,8 +227,8 @@ public class CompositeIdentifierSingularAttributeSourceManyToOneImpl
}
@Override
public boolean isEmbedXml() {
return false;
public Boolean isEmbedXml() {
return null;
}
@Override

View File

@ -2112,10 +2112,10 @@ public class ModelBinder {
// todo : probably need some reflection here if null
oneToOneBinding.setReferencedEntityName( oneToOneSource.getReferencedEntityName() );
if ( oneToOneSource.isEmbedXml() ) {
if ( oneToOneSource.isEmbedXml() == Boolean.TRUE ) {
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfEmbedXmlSupport();
}
oneToOneBinding.setEmbedded( oneToOneSource.isEmbedXml() );
oneToOneBinding.setEmbedded( oneToOneSource.isEmbedXml() != Boolean.FALSE );
if ( StringHelper.isNotEmpty( oneToOneSource.getExplicitForeignKeyName() ) ) {
oneToOneBinding.setForeignKeyName( oneToOneSource.getExplicitForeignKeyName() );
@ -2231,10 +2231,10 @@ public class ModelBinder {
: FetchMode.JOIN
);
if ( manyToOneSource.isEmbedXml() ) {
if ( manyToOneSource.isEmbedXml() == Boolean.TRUE ) {
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfEmbedXmlSupport();
}
manyToOneBinding.setEmbedded( manyToOneSource.isEmbedXml() );
manyToOneBinding.setEmbedded( manyToOneSource.isEmbedXml() != Boolean.FALSE );
manyToOneBinding.setIgnoreNotFound( manyToOneSource.isIgnoreNotFound() );
@ -3526,15 +3526,6 @@ public class ModelBinder {
elementBinding.setReferencedEntityName( referencedEntityBinding.getEntityName() );
elementBinding.setAssociatedClass( referencedEntityBinding );
String embed = elementSource.getXmlNodeName();
// sometimes embed is set to the default value when not specified in the mapping,
// so can't seem to determine if an attribute was explicitly set;
// log a warning if embed has a value different from the default.
if ( !StringHelper.isEmpty( embed ) && !"true".equals( embed ) ) {
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfEmbedXmlSupport();
}
elementBinding.setEmbedded( embed == null || "true".equals( embed ) );
elementBinding.setIgnoreNotFound( elementSource.isIgnoreNotFound() );
}
else if ( getPluralAttributeSource().getElementSource() instanceof PluralAttributeElementSourceManyToMany ) {

View File

@ -175,7 +175,7 @@ class SingularAttributeSourceManyToOneImpl
}
@Override
public boolean isEmbedXml() {
public Boolean isEmbedXml() {
return manyToOneElement.isEmbedXml();
}

View File

@ -222,7 +222,7 @@ class SingularAttributeSourceOneToOneImpl
}
@Override
public boolean isEmbedXml() {
public Boolean isEmbedXml() {
return oneToOneElement.isEmbedXml();
}
}

View File

@ -29,5 +29,5 @@ public interface SingularAttributeSourceToOne
public boolean isUnique();
public boolean isEmbedXml();
public Boolean isEmbedXml();
}

View File

@ -409,7 +409,7 @@ etc. to an entity). -->
<!ATTLIST many-to-one lazy (false|proxy|no-proxy) #IMPLIED>
<!ATTLIST many-to-one not-found (exception|ignore) "exception">
<!ATTLIST many-to-one node CDATA #IMPLIED>
<!ATTLIST many-to-one embed-xml (true|false) "true">
<!ATTLIST many-to-one embed-xml (true|false) #IMPLIED>
<!-- Declares a one-to-one association between two entities (Or from a component,
component element, etc. to an entity). -->
@ -428,7 +428,7 @@ component element, etc. to an entity). -->
<!ATTLIST one-to-one property-ref CDATA #IMPLIED>
<!ATTLIST one-to-one lazy (false|proxy|no-proxy) #IMPLIED>
<!ATTLIST one-to-one node CDATA #IMPLIED>
<!ATTLIST one-to-one embed-xml (true|false) "true">
<!ATTLIST one-to-one embed-xml (true|false) #IMPLIED>
<!-- A property embedded in a composite identifier or map index (always not-null). -->
@ -565,7 +565,7 @@ relationship from the collection table to the enclosing class. -->
<!ATTLIST map collection-type CDATA #IMPLIED>
<!ATTLIST map optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST map node CDATA #IMPLIED>
<!ATTLIST map embed-xml (true|false) "true">
<!ATTLIST map embed-xml (true|false) #IMPLIED>
<!ELEMENT set (
meta*,
@ -599,7 +599,7 @@ relationship from the collection table to the enclosing class. -->
<!ATTLIST set check CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST set optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST set node CDATA #IMPLIED>
<!ATTLIST set embed-xml (true|false) "true">
<!ATTLIST set embed-xml (true|false) #IMPLIED>
<!ELEMENT bag (
meta*,
@ -632,7 +632,7 @@ relationship from the collection table to the enclosing class. -->
<!ATTLIST bag check CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST bag optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST bag node CDATA #IMPLIED>
<!ATTLIST bag embed-xml (true|false) "true">
<!ATTLIST bag embed-xml (true|false) #IMPLIED>
<!ELEMENT idbag (
meta*,
@ -665,7 +665,7 @@ relationship from the collection table to the enclosing class. -->
<!ATTLIST idbag check CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST idbag optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST idbag node CDATA #IMPLIED>
<!ATTLIST idbag embed-xml (true|false) "true">
<!ATTLIST idbag embed-xml (true|false) #IMPLIED>
<!ELEMENT list (
meta*,
@ -698,7 +698,7 @@ relationship from the collection table to the enclosing class. -->
<!ATTLIST list check CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST list optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST list node CDATA #IMPLIED>
<!ATTLIST list embed-xml (true|false) "true">
<!ATTLIST list embed-xml (true|false) #IMPLIED>
<!ELEMENT array (
meta*,
@ -730,7 +730,7 @@ relationship from the collection table to the enclosing class. -->
<!ATTLIST array check CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST array optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST array node CDATA #IMPLIED>
<!ATTLIST array embed-xml (true|false) "true">
<!ATTLIST array embed-xml (true|false) #IMPLIED>
<!ELEMENT primitive-array (
meta*,
@ -759,7 +759,7 @@ relationship from the collection table to the enclosing class. -->
<!ATTLIST primitive-array check CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST primitive-array optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST primitive-array node CDATA #IMPLIED>
<!ATTLIST primitive-array embed-xml (true|false) "true">
<!ATTLIST primitive-array embed-xml (true|false) #IMPLIED>
<!-- Declares the element type of a collection of basic type -->
@ -781,7 +781,7 @@ element type of a collection and specifies a one-to-many relational model -->
<!ATTLIST one-to-many class CDATA #IMPLIED>
<!ATTLIST one-to-many not-found (exception|ignore) "exception">
<!ATTLIST one-to-many node CDATA #IMPLIED>
<!ATTLIST one-to-many embed-xml (true|false) "true">
<!ATTLIST one-to-many embed-xml (true|false) #IMPLIED>
<!ATTLIST one-to-many entity-name CDATA #IMPLIED>
<!-- No column declaration attributes required in this case. The primary
key column of the associated class is already mapped elsewhere.-->
@ -792,7 +792,7 @@ element type of a collection and specifies a many-to-many relational model -->
<!ELEMENT many-to-many (meta*,(column|formula)*,filter*)>
<!ATTLIST many-to-many class CDATA #IMPLIED>
<!ATTLIST many-to-many node CDATA #IMPLIED>
<!ATTLIST many-to-many embed-xml (true|false) "true">
<!ATTLIST many-to-many embed-xml (true|false) #IMPLIED>
<!ATTLIST many-to-many entity-name CDATA #IMPLIED>
<!ATTLIST many-to-many column CDATA #IMPLIED>
<!ATTLIST many-to-many formula CDATA #IMPLIED>

View File

@ -435,7 +435,7 @@ arbitrary number of queries, and import declarations of arbitrary classes.
<xs:attribute name="check" type="xs:string"/> <!-- default: none -->
<xs:attribute name="collection-type" type="xs:string"/>
<xs:attribute name="element-class" type="xs:string"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/> <!-- default="true" -->
<xs:attribute name="fetch" type="fetch-attribute-with-subselect"/>
<xs:attribute name="inverse" default="false" type="xs:boolean"/>
<xs:attribute name="mutable" default="true" type="xs:boolean"/>
@ -479,7 +479,7 @@ arbitrary number of queries, and import declarations of arbitrary classes.
<xs:attribute name="catalog" type="xs:string"/> <!-- default: none -->
<xs:attribute name="check" type="xs:string"/> <!-- default: none -->
<xs:attribute name="collection-type" type="xs:string"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/> <!-- default="true" -->
<xs:attribute name="fetch" type="fetch-attribute-with-subselect"/>
<xs:attribute name="inverse" default="false" type="xs:boolean"/>
<xs:attribute name="lazy" type="lazy-attribute-with-extra"/>
@ -748,7 +748,7 @@ arbitrary number of queries, and import declarations of arbitrary classes.
<xs:attribute name="catalog" type="xs:string"/> <!-- default: none -->
<xs:attribute name="check" type="xs:string"/> <!-- default: none -->
<xs:attribute name="collection-type" type="xs:string"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/> <!-- default="true" -->
<xs:attribute name="fetch" type="fetch-attribute-with-subselect"/>
<xs:attribute name="lazy" type="lazy-attribute-with-extra"/>
<xs:attribute name="mutable" default="true" type="xs:boolean"/>
@ -954,7 +954,7 @@ arbitrary number of queries, and import declarations of arbitrary classes.
<xs:attribute name="catalog" type="xs:string"/> <!-- default: none -->
<xs:attribute name="check" type="xs:string"/> <!-- default: none -->
<xs:attribute name="collection-type" type="xs:string"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/> <!-- default="true" -->
<xs:attribute name="fetch" type="fetch-attribute-with-subselect"/>
<xs:attribute name="inverse" default="false" type="xs:boolean"/>
<xs:attribute name="lazy" type="lazy-attribute-with-extra"/>
@ -1022,7 +1022,7 @@ arbitrary number of queries, and import declarations of arbitrary classes.
</xs:sequence>
<xs:attribute name="class" type="xs:string"/>
<xs:attribute name="column" type="xs:string"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/> <!-- default="true"-->
<xs:attribute name="entity-name" type="xs:string"/>
<xs:attribute name="fetch" type="fetch-attribute"/>
<xs:attribute name="foreign-key" type="xs:string"/>
@ -1053,7 +1053,7 @@ arbitrary number of queries, and import declarations of arbitrary classes.
<xs:attribute name="cascade" type="xs:string"/>
<xs:attribute name="class" type="xs:string"/>
<xs:attribute name="column" type="xs:string"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/> <!-- default="true" -->
<xs:attribute name="entity-name" type="xs:string"/>
<xs:attribute name="fetch" type="fetch-attribute"/>
<xs:attribute name="foreign-key" type="xs:string"/>
@ -1187,7 +1187,7 @@ arbitrary number of queries, and import declarations of arbitrary classes.
<xs:attribute name="catalog" type="xs:string"/> <!-- default: none -->
<xs:attribute name="check" type="xs:string"/> <!-- default: none -->
<xs:attribute name="collection-type" type="xs:string"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/> <!-- default="true" -->
<xs:attribute name="fetch" type="fetch-attribute-with-subselect"/>
<xs:attribute name="inverse" default="false" type="xs:boolean"/>
<xs:attribute name="lazy" type="lazy-attribute-with-extra"/>
@ -1245,7 +1245,7 @@ arbitrary number of queries, and import declarations of arbitrary classes.
element type of a collection and specifies a one-to-many relational model -->
<xs:complexType name="one-to-many-element">
<xs:attribute name="class" type="xs:string"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/> <!-- default="true" -->
<xs:attribute name="entity-name" type="xs:string"/>
<xs:attribute name="node" type="xs:string"/>
<xs:attribute name="not-found" default="exception" type="not-found-attribute"/>
@ -1264,7 +1264,7 @@ arbitrary number of queries, and import declarations of arbitrary classes.
<xs:attribute name="cascade" type="xs:string"/>
<xs:attribute name="class" type="xs:string"/>
<xs:attribute name="constrained" default="false" type="xs:boolean"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/> <!-- default="true" -->
<xs:attribute name="entity-name" type="xs:string"/>
<xs:attribute name="fetch" type="fetch-attribute"/>
<xs:attribute name="foreign-key" type="xs:string"/>
@ -1315,7 +1315,7 @@ arbitrary number of queries, and import declarations of arbitrary classes.
<xs:attribute name="catalog" type="xs:string"/> <!-- default: none -->
<xs:attribute name="check" type="xs:string"/> <!-- default: none -->
<xs:attribute name="collection-type" type="xs:string"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/> <!-- default="true" -->
<xs:attribute name="fetch" type="fetch-attribute-with-subselect"/>
<xs:attribute name="mutable" default="true" type="xs:boolean"/>
<xs:attribute name="name" use="required" type="xs:string"/>
@ -1502,7 +1502,7 @@ arbitrary number of queries, and import declarations of arbitrary classes.
<xs:attribute name="catalog" type="xs:string"/> <!-- default: none -->
<xs:attribute name="check" type="xs:string"/> <!-- default: none -->
<xs:attribute name="collection-type" type="xs:string"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/> <!-- default="true" -->
<xs:attribute name="fetch" type="fetch-attribute-with-subselect"/>
<xs:attribute name="inverse" default="false" type="xs:boolean"/>
<xs:attribute name="lazy" type="lazy-attribute-with-extra"/>

View File

@ -749,7 +749,7 @@
</xs:sequence>
<xs:attributeGroup ref="table-information-group"/>
<xs:attributeGroup ref="plural-basic-attribute-group"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/>
<xs:attribute name="fetch" type="FetchStyleWithSubselectEnum"/>
<xs:attribute name="lazy" type="LazyWithExtraEnum"/>
<xs:attribute name="node" type="xs:string"/>
@ -801,7 +801,7 @@
<!-- default: none -->
<xs:attribute name="collection-type" type="xs:string"/>
<xs:attribute name="element-class" type="xs:string"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/>
<xs:attribute name="fetch" type="FetchStyleWithSubselectEnum"/>
<xs:attribute name="lazy" type="LazyWithExtraEnum"/>
<xs:attribute name="inverse" default="false" type="xs:boolean"/>
@ -835,7 +835,7 @@
</xs:sequence>
<xs:attributeGroup ref="table-information-group"/>
<xs:attributeGroup ref="plural-basic-attribute-group"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/>
<xs:attribute name="fetch" type="FetchStyleWithSubselectEnum"/>
<xs:attribute name="lazy" type="LazyWithExtraEnum"/>
<xs:attribute name="node" type="xs:string"/>
@ -867,7 +867,7 @@
</xs:sequence>
<xs:attributeGroup ref="table-information-group"/>
<xs:attributeGroup ref="plural-basic-attribute-group"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/>
<xs:attribute name="fetch" type="FetchStyleWithSubselectEnum"/>
<xs:attribute name="lazy" type="LazyWithExtraEnum"/>
<xs:attribute name="node" type="xs:string"/>
@ -902,7 +902,7 @@
</xs:sequence>
<xs:attributeGroup ref="table-information-group"/>
<xs:attributeGroup ref="plural-basic-attribute-group"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/>
<xs:attribute name="fetch" type="FetchStyleWithSubselectEnum"/>
<xs:attribute name="lazy" type="LazyWithExtraEnum"/>
<xs:attribute name="node" type="xs:string"/>
@ -932,7 +932,7 @@
</xs:sequence>
<xs:attributeGroup ref="table-information-group"/>
<xs:attributeGroup ref="plural-basic-attribute-group"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/>
<xs:attribute name="fetch" type="FetchStyleWithSubselectEnum"/>
<xs:attribute name="lazy" type="LazyWithExtraEnum"/>
<xs:attribute name="node" type="xs:string"/>
@ -960,7 +960,7 @@
<xs:complexType name="OneToManyCollectionElementType">
<xs:attribute name="class" type="ClassNameType"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/>
<xs:attribute name="entity-name" type="xs:string"/>
<xs:attribute name="node" type="xs:string"/>
<xs:attribute name="not-found" default="exception" type="NotFoundEnum"/>
@ -976,7 +976,7 @@
<xs:attribute name="cascade" type="xs:string"/>
<xs:attribute name="class" type="ClassNameType"/>
<xs:attribute name="constrained" default="false" type="xs:boolean"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/>
<xs:attribute name="entity-name" type="xs:string"/>
<xs:attribute name="fetch" type="FetchStyleEnum"/>
<xs:attribute name="foreign-key" type="xs:string"/>
@ -1002,7 +1002,7 @@
<xs:attribute name="cascade" type="xs:string"/>
<xs:attribute name="class" type="ClassNameType"/>
<xs:attribute name="column" type="xs:string"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/>
<xs:attribute name="entity-name" type="xs:string"/>
<xs:attribute name="fetch" type="FetchStyleEnum"/>
<xs:attribute name="foreign-key" type="xs:string"/>
@ -1036,7 +1036,7 @@
</xs:sequence>
<xs:attribute name="class" type="ClassNameType"/>
<xs:attribute name="column" type="xs:string"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/>
<xs:attribute name="entity-name" type="xs:string"/>
<xs:attribute name="fetch" type="FetchStyleEnum"/>
<xs:attribute name="foreign-key" type="xs:string"/>
@ -1639,7 +1639,7 @@
<xs:attribute name="check" type="xs:string"/>
<!-- default: none -->
<xs:attribute name="collection-type" type="xs:string"/>
<xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
<xs:attribute name="embed-xml" type="xs:boolean"/>
<xs:attribute name="fetch" type="FetchStyleWithSubselectEnum"/>
<xs:attribute name="mutable" default="true" type="xs:boolean"/>
<xs:attribute name="name" use="required" type="xs:string"/>