HHH-12937 : Where clause for collections of basic, embeddable and "any" elements is ignored when mapped using hbm.xml

This commit is contained in:
Gail Badner 2018-08-29 23:12:13 -07:00
parent da50076afc
commit eb14b8de6f
1 changed files with 18 additions and 0 deletions

View File

@ -3386,6 +3386,11 @@ public class ModelBinder {
}
protected void bindCollectionElement() {
log.debugf(
"Binding [%s] element type for a [%s]",
getPluralAttributeSource().getElementSource().getNature(),
getPluralAttributeSource().getNature()
);
if ( getPluralAttributeSource().getElementSource() instanceof PluralAttributeElementSourceBasic ) {
final PluralAttributeElementSourceBasic elementSource =
(PluralAttributeElementSourceBasic) getPluralAttributeSource().getElementSource();
@ -3414,6 +3419,10 @@ public class ModelBinder {
);
getCollectionBinding().setElement( elementBinding );
// Collection#setWhere is used to set the "where" clause that applies to the collection table
// (the table containing the basic elements)
// This "where" clause comes from the collection mapping; e.g., <set name="..." ... where="..." .../>
getCollectionBinding().setWhere( getPluralAttributeSource().getWhere() );
}
else if ( getPluralAttributeSource().getElementSource() instanceof PluralAttributeElementSourceEmbedded ) {
final PluralAttributeElementSourceEmbedded elementSource =
@ -3435,6 +3444,10 @@ public class ModelBinder {
);
getCollectionBinding().setElement( elementBinding );
// Collection#setWhere is used to set the "where" clause that applies to the collection table
// (the table containing the embeddable elements)
// This "where" clause comes from the collection mapping; e.g., <set name="..." ... where="..." .../>
getCollectionBinding().setWhere( getPluralAttributeSource().getWhere() );
}
else if ( getPluralAttributeSource().getElementSource() instanceof PluralAttributeElementSourceOneToMany ) {
final PluralAttributeElementSourceOneToMany elementSource =
@ -3603,6 +3616,11 @@ public class ModelBinder {
);
getCollectionBinding().setElement( elementBinding );
// Collection#setWhere is used to set the "where" clause that applies to the collection table
// (which is the join table for a many-to-any association).
// This "where" clause comes from the collection mapping; e.g., <set name="..." ... where="..." .../>
getCollectionBinding().setWhere( getPluralAttributeSource().getWhere() );
getCollectionBinding().setWhere( getPluralAttributeSource().getWhere() );
}
}
}