HHH-12937 : Where clause for collections of basic, embeddable and "any" elements is ignored when mapped using hbm.xml
(cherry picked from commit eb14b8de6f
)
This commit is contained in:
parent
7c4d18404c
commit
faabcafa81
|
@ -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() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue