HHH-6251 : Fixes/improvements to CollectionEement-related classes
This commit is contained in:
parent
e61896454b
commit
6a3d4dc4ca
|
@ -23,13 +23,11 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.metamodel.binding;
|
package org.hibernate.metamodel.binding;
|
||||||
|
|
||||||
import org.dom4j.Element;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
public class ElementCollectionElement extends CollectionElement {
|
public class BasicCollectionElement extends CollectionElement {
|
||||||
public ElementCollectionElement(PluralAttributeBinding binding) {
|
public BasicCollectionElement(PluralAttributeBinding binding) {
|
||||||
super( binding, CollectionElementType.ELEMENT );
|
super( binding, CollectionElementType.BASIC );
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -27,14 +27,14 @@ package org.hibernate.metamodel.binding;
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
public enum CollectionElementType {
|
public enum CollectionElementType {
|
||||||
ELEMENT( "element" ) {
|
BASIC( "basic" ) {
|
||||||
public CollectionElement createCollectionElementInternal(PluralAttributeBinding attributeBinding) {
|
public CollectionElement createCollectionElementInternal(PluralAttributeBinding attributeBinding) {
|
||||||
return new ElementCollectionElement( attributeBinding );
|
return new BasicCollectionElement( attributeBinding );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
COMPOSITE_ELEMENT( "composite-element" ) {
|
COMPOSITE( "composite" ) {
|
||||||
public CollectionElement createCollectionElementInternal(PluralAttributeBinding attributeBinding) {
|
public CollectionElement createCollectionElementInternal(PluralAttributeBinding attributeBinding) {
|
||||||
return new ElementCollectionElement( attributeBinding );
|
return new CompositeCollectionElement( attributeBinding );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ONE_TO_MANY( "one-to-many" ) {
|
ONE_TO_MANY( "one-to-many" ) {
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.metamodel.binding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Gail Badner
|
||||||
|
*/
|
||||||
|
public class CompositeCollectionElement extends CollectionElement {
|
||||||
|
public CompositeCollectionElement(PluralAttributeBinding binding) {
|
||||||
|
super( binding, CollectionElementType.COMPOSITE );
|
||||||
|
}
|
||||||
|
}
|
|
@ -48,7 +48,7 @@ public abstract class PluralAttributeBinding extends AbstractAttributeBinding {
|
||||||
private Table collectionTable;
|
private Table collectionTable;
|
||||||
|
|
||||||
private CollectionKey collectionKey;
|
private CollectionKey collectionKey;
|
||||||
private CollectionElement collectionElement;
|
private final CollectionElement collectionElement;
|
||||||
|
|
||||||
// private String role;
|
// private String role;
|
||||||
private FetchMode fetchMode;
|
private FetchMode fetchMode;
|
||||||
|
@ -88,7 +88,6 @@ public abstract class PluralAttributeBinding extends AbstractAttributeBinding {
|
||||||
super.initialize( state );
|
super.initialize( state );
|
||||||
fetchMode = state.getFetchMode();
|
fetchMode = state.getFetchMode();
|
||||||
extraLazy = state.isExtraLazy();
|
extraLazy = state.isExtraLazy();
|
||||||
collectionElement = new ElementCollectionElement( this );
|
|
||||||
collectionElement.setNodeName( state.getElementNodeName() );
|
collectionElement.setNodeName( state.getElementNodeName() );
|
||||||
collectionElement.setTypeName( state.getElementTypeName() );
|
collectionElement.setTypeName( state.getElementTypeName() );
|
||||||
inverse = state.isInverse();
|
inverse = state.isInverse();
|
||||||
|
@ -144,9 +143,6 @@ public abstract class PluralAttributeBinding extends AbstractAttributeBinding {
|
||||||
return collectionElement;
|
return collectionElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCollectionElement(CollectionElement collectionElement) {
|
|
||||||
this.collectionElement = collectionElement;
|
|
||||||
}
|
|
||||||
public boolean isExtraLazy() {
|
public boolean isExtraLazy() {
|
||||||
return extraLazy;
|
return extraLazy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -502,10 +502,10 @@ PrimitiveArray
|
||||||
|
|
||||||
private CollectionElementType getCollectionElementType(XMLBagElement collection) {
|
private CollectionElementType getCollectionElementType(XMLBagElement collection) {
|
||||||
if ( collection.getElement() != null ) {
|
if ( collection.getElement() != null ) {
|
||||||
return CollectionElementType.ELEMENT;
|
return CollectionElementType.BASIC;
|
||||||
}
|
}
|
||||||
else if ( collection.getCompositeElement() != null ) {
|
else if ( collection.getCompositeElement() != null ) {
|
||||||
return CollectionElementType.COMPOSITE_ELEMENT;
|
return CollectionElementType.COMPOSITE;
|
||||||
}
|
}
|
||||||
else if ( collection.getManyToMany() != null ) {
|
else if ( collection.getManyToMany() != null ) {
|
||||||
return CollectionElementType.MANY_TO_MANY;
|
return CollectionElementType.MANY_TO_MANY;
|
||||||
|
|
Loading…
Reference in New Issue