mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 08:35:13 +00:00
HHH-7702 : Add support for collections of (aggregated) composite elements
This commit is contained in:
parent
84f65d4b41
commit
fc66ca54c3
@ -520,7 +520,10 @@ private void bindCompositeCollectionElement(
|
||||
final CompositeAttributeBindingContainer compositeAttributeBindingContainer =
|
||||
elementBinding.createCompositeAttributeBindingContainer(
|
||||
aggregate,
|
||||
pluralAttributeBinding.getMetaAttributeContext(), // TODO: should get this from elementSource
|
||||
createMetaAttributeContext(
|
||||
pluralAttributeBinding.getContainer(),
|
||||
elementSource.getMetaAttributeSources()
|
||||
),
|
||||
parentAttribute
|
||||
);
|
||||
|
||||
|
@ -100,22 +100,22 @@ private PluralAttributeElementSource interpretElementType() {
|
||||
else if ( pluralAttributeElement.getCompositeElement() != null ) {
|
||||
return new CompositePluralAttributeElementSourceImpl(
|
||||
sourceMappingDocument(),
|
||||
pluralAttributeElement,
|
||||
pluralAttributeElement.getCompositeElement()
|
||||
pluralAttributeElement.getCompositeElement(),
|
||||
pluralAttributeElement.getCascade()
|
||||
);
|
||||
}
|
||||
else if ( pluralAttributeElement.getOneToMany() != null ) {
|
||||
return new OneToManyPluralAttributeElementSourceImpl(
|
||||
sourceMappingDocument(),
|
||||
pluralAttributeElement,
|
||||
pluralAttributeElement.getOneToMany()
|
||||
pluralAttributeElement.getOneToMany(),
|
||||
pluralAttributeElement.getCascade()
|
||||
);
|
||||
}
|
||||
else if ( pluralAttributeElement.getManyToMany() != null ) {
|
||||
return new ManyToManyPluralAttributeElementSourceImpl(
|
||||
sourceMappingDocument(),
|
||||
pluralAttributeElement,
|
||||
pluralAttributeElement.getManyToMany()
|
||||
pluralAttributeElement.getManyToMany(),
|
||||
pluralAttributeElement.getCascade()
|
||||
);
|
||||
}
|
||||
else if ( pluralAttributeElement.getManyToAny() != null ) {
|
||||
|
@ -37,11 +37,11 @@
|
||||
import org.hibernate.jaxb.spi.hbm.JaxbNestedCompositeElementElement;
|
||||
import org.hibernate.jaxb.spi.hbm.JaxbPropertyElement;
|
||||
import org.hibernate.jaxb.spi.hbm.JaxbTuplizerElement;
|
||||
import org.hibernate.jaxb.spi.hbm.PluralAttributeElement;
|
||||
import org.hibernate.metamodel.spi.binding.SingularAttributeBinding;
|
||||
import org.hibernate.metamodel.spi.source.AttributeSource;
|
||||
import org.hibernate.metamodel.spi.source.CompositePluralAttributeElementSource;
|
||||
import org.hibernate.metamodel.spi.source.LocalBindingContext;
|
||||
import org.hibernate.metamodel.spi.source.MetaAttributeSource;
|
||||
import org.hibernate.metamodel.spi.source.SingularAttributeSource;
|
||||
|
||||
/**
|
||||
@ -52,17 +52,17 @@ public class CompositePluralAttributeElementSourceImpl
|
||||
extends AbstractHbmSourceNode
|
||||
implements CompositePluralAttributeElementSource {
|
||||
|
||||
private final PluralAttributeElement pluralAttributeElement;
|
||||
private final JaxbCompositeElementElement compositeElement;
|
||||
private final Iterable<CascadeStyle> cascadeStyles;
|
||||
private final List<AttributeSource> attributeSources;
|
||||
|
||||
public CompositePluralAttributeElementSourceImpl(
|
||||
MappingDocument mappingDocument,
|
||||
PluralAttributeElement pluralAttributeElement,
|
||||
JaxbCompositeElementElement compositeElement) {
|
||||
JaxbCompositeElementElement compositeElement,
|
||||
String cascadeString) {
|
||||
super( mappingDocument );
|
||||
this.pluralAttributeElement = pluralAttributeElement;
|
||||
this.compositeElement = compositeElement;
|
||||
this.cascadeStyles = Helper.interpretCascadeStyles( cascadeString, bindingContext() );
|
||||
this.attributeSources = buildAttributeSources( mappingDocument, compositeElement );
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ public LocalBindingContext getLocalBindingContext() {
|
||||
|
||||
@Override
|
||||
public Iterable<CascadeStyle> getCascadeStyles() {
|
||||
return Helper.interpretCascadeStyles( pluralAttributeElement.getCascade(), bindingContext() );
|
||||
return cascadeStyles;
|
||||
}
|
||||
|
||||
private static AttributeSource buildAttributeSource(
|
||||
@ -178,4 +178,8 @@ private static AttributeSource buildAttributeSource(
|
||||
throw new NotYetImplementedException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends MetaAttributeSource> getMetaAttributeSources() {
|
||||
return compositeElement.getMeta();
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.jaxb.spi.hbm.JaxbColumnElement;
|
||||
import org.hibernate.jaxb.spi.hbm.JaxbManyToManyElement;
|
||||
import org.hibernate.jaxb.spi.hbm.PluralAttributeElement;
|
||||
import org.hibernate.metamodel.spi.source.ManyToManyPluralAttributeElementSource;
|
||||
import org.hibernate.metamodel.spi.source.RelationalValueSource;
|
||||
|
||||
@ -41,18 +40,18 @@
|
||||
public class ManyToManyPluralAttributeElementSourceImpl
|
||||
extends AbstractHbmSourceNode
|
||||
implements ManyToManyPluralAttributeElementSource {
|
||||
private final PluralAttributeElement pluralAttributeElement;
|
||||
private final JaxbManyToManyElement manyToManyElement;
|
||||
private final Iterable<CascadeStyle> cascadeStyles;
|
||||
|
||||
private final List<RelationalValueSource> valueSources;
|
||||
|
||||
public ManyToManyPluralAttributeElementSourceImpl(
|
||||
MappingDocument mappingDocument,
|
||||
final PluralAttributeElement pluralAttributeElement,
|
||||
final JaxbManyToManyElement manyToManyElement) {
|
||||
final JaxbManyToManyElement manyToManyElement,
|
||||
String cascadeString) {
|
||||
super( mappingDocument );
|
||||
this.pluralAttributeElement = pluralAttributeElement;
|
||||
this.manyToManyElement = manyToManyElement;
|
||||
this.cascadeStyles = Helper.interpretCascadeStyles( cascadeString, bindingContext() );
|
||||
|
||||
this.valueSources = Helper.buildValueSources(
|
||||
sourceMappingDocument(),
|
||||
@ -145,7 +144,7 @@ public String getWhere() {
|
||||
|
||||
@Override
|
||||
public Iterable<CascadeStyle> getCascadeStyles() {
|
||||
return Helper.interpretCascadeStyles( pluralAttributeElement.getCascade(), bindingContext() );
|
||||
return cascadeStyles;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,6 @@
|
||||
import org.hibernate.engine.spi.CascadeStyle;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.jaxb.spi.hbm.JaxbOneToManyElement;
|
||||
import org.hibernate.jaxb.spi.hbm.PluralAttributeElement;
|
||||
import org.hibernate.metamodel.spi.source.OneToManyPluralAttributeElementSource;
|
||||
|
||||
/**
|
||||
@ -35,16 +34,16 @@
|
||||
public class OneToManyPluralAttributeElementSourceImpl
|
||||
extends AbstractHbmSourceNode
|
||||
implements OneToManyPluralAttributeElementSource {
|
||||
private final PluralAttributeElement pluralAttributeElement;
|
||||
private final JaxbOneToManyElement oneToManyElement;
|
||||
private final Iterable<CascadeStyle> cascadeStyles;
|
||||
|
||||
public OneToManyPluralAttributeElementSourceImpl(
|
||||
MappingDocument mappingDocument,
|
||||
PluralAttributeElement pluralAttributeElement,
|
||||
JaxbOneToManyElement oneToManyElement) {
|
||||
JaxbOneToManyElement oneToManyElement,
|
||||
String cascadeString) {
|
||||
super( mappingDocument );
|
||||
this.pluralAttributeElement = pluralAttributeElement;
|
||||
this.oneToManyElement = oneToManyElement;
|
||||
this.cascadeStyles = Helper.interpretCascadeStyles( cascadeString, bindingContext() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -67,6 +66,6 @@ public boolean isNotFoundAnException() {
|
||||
|
||||
@Override
|
||||
public Iterable<CascadeStyle> getCascadeStyles() {
|
||||
return Helper.interpretCascadeStyles( pluralAttributeElement.getCascade(), bindingContext() );
|
||||
return cascadeStyles;
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ public class CompositePluralAttributeElementBinding
|
||||
extends AbstractPluralAttributeElementBinding
|
||||
implements Cascadeable {
|
||||
|
||||
// TODO: Come up with a more descriptive name for compositeAttributeBindingContainer.
|
||||
private AbstractCompositeAttributeBindingContainer compositeAttributeBindingContainer;
|
||||
private CascadeStyle cascadeStyle;
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface CompositePluralAttributeElementSource
|
||||
extends PluralAttributeElementSource, AttributeSourceContainer, CascadeStyleSource {
|
||||
extends PluralAttributeElementSource, AttributeSourceContainer, CascadeStyleSource, MetaSource {
|
||||
public String getClassName();
|
||||
|
||||
public ValueHolder<Class<?>> getClassReference();
|
||||
|
Loading…
x
Reference in New Issue
Block a user