diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/AbstractAttributeBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/AbstractAttributeBinding.java index 5d7b785e92..db72ad9424 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/AbstractAttributeBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/AbstractAttributeBinding.java @@ -30,7 +30,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.hibernate.MappingException; import org.hibernate.metamodel.domain.Attribute; import org.hibernate.metamodel.domain.MetaAttribute; import org.hibernate.metamodel.relational.Column; @@ -39,6 +38,10 @@ import org.hibernate.metamodel.relational.SimpleValue; import org.hibernate.metamodel.relational.TableSpecification; import org.hibernate.metamodel.relational.Tuple; import org.hibernate.metamodel.relational.Value; +import org.hibernate.metamodel.relational.ValueFactory; +import org.hibernate.metamodel.state.domain.AttributeDomainState; +import org.hibernate.metamodel.state.relational.ValueRelationalState; +import org.hibernate.metamodel.state.relational.TupleRelationalState; /** * TODO : javadoc @@ -46,17 +49,6 @@ import org.hibernate.metamodel.relational.Value; * @author Steve Ebersole */ public abstract class AbstractAttributeBinding implements AttributeBinding { - public static interface DomainState { - HibernateTypeDescriptor getHibernateTypeDescriptor(); - Attribute getAttribute(); - boolean isLazy(); - String getPropertyAccessorName(); - boolean isAlternateUniqueKey(); - String getCascade(); - boolean isOptimisticLockable(); - String getNodeName(); - Map getMetaAttributes(EntityBinding entityBinding); - } private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor(); private final EntityBinding entityBinding; @@ -81,7 +73,7 @@ public abstract class AbstractAttributeBinding implements AttributeBinding { this.entityBinding = entityBinding; } - protected void initialize(DomainState state) { + protected void initialize(AttributeDomainState state) { hibernateTypeDescriptor.initialize( state.getHibernateTypeDescriptor() ); attribute = state.getAttribute(); isLazy = state.isLazy(); @@ -90,7 +82,7 @@ public abstract class AbstractAttributeBinding implements AttributeBinding { cascade = state.getCascade(); optimisticLockable = state.isOptimisticLockable(); nodeName = state.getNodeName(); - metaAttributes = state.getMetaAttributes( entityBinding ); + metaAttributes = state.getMetaAttributes(); } @Override @@ -115,94 +107,24 @@ public abstract class AbstractAttributeBinding implements AttributeBinding { return false; } - protected void initializeColumnValue(ColumnRelationalState state) { - value = createColumn( state ); + protected void initializeValue(ValueRelationalState state) { + value = ValueFactory.createValue( getEntityBinding().getBaseTable(), + getAttribute().getName(), + convertToSimpleRelationalStateIfPossible( state ), + forceNonNullable(), + forceUnique() + ); } - private Column createColumn(ColumnRelationalState state) { - final String explicitName = state.getExplicitColumnName(); - final String logicalColumnName = state.getNamingStrategy().logicalColumnName( explicitName, getAttribute().getName() ); - final TableSpecification table = getEntityBinding().getBaseTable(); - final String columnName = - explicitName == null ? - state.getNamingStrategy().propertyToColumnName( getAttribute().getName() ) : - state.getNamingStrategy().columnName( explicitName ); -// todo : find out the purpose of these logical bindings -// mappings.addColumnBinding( logicalColumnName, column, table ); - Column columnValue = table.createColumn( columnName ); - columnValue.getSize().initialize( state.getSize() ); - columnValue.setNullable( ! forceNonNullable() && state.isNullable() ); - columnValue.setUnique( ! forceUnique() && state.isUnique() ); - columnValue.setCheckCondition( state.getCheckCondition() ); - columnValue.setDefaultValue( state.getDefault() ); - columnValue.setSqlType( state.getSqlType() ); - columnValue.setWriteFragment( state.getCustomWriteFragment() ); - columnValue.setReadFragment( state.getCustomReadFragment() ); - columnValue.setComment( state.getComment() ); - for ( String uniqueKey : state.getUniqueKeys() ) { - table.getOrCreateUniqueKey( uniqueKey ).addColumn( columnValue ); + // TODO: should a single-valued tuple always be converted??? + protected ValueRelationalState convertToSimpleRelationalStateIfPossible(ValueRelationalState state) { + if ( !TupleRelationalState.class.isInstance( state ) ) { + return state; } - for ( String index : state.getIndexes() ) { - table.getOrCreateIndex( index ).addColumn( columnValue ); - } - return columnValue; - } - - // TODO: move this logic out... - protected void initialize(RelationalState state) { - if ( SingleValueRelationalState.class.isInstance( state ) ) { - initializeSingleValue( SingleValueRelationalState.class.cast( state ) ); - } - else if ( SimpleTupleRelationalState.class.isInstance( state ) ) { - initializeSimpleTupleValue( SimpleTupleRelationalState.class.cast( state ) ); - } - else { - throw new MappingException( "Unexpected type of RelationalState" + state.getClass().getName() ); - } - } - - protected void initializeDerivedValue(T state) { - value = createDerivedValue( state ); - } - - private DerivedValue createDerivedValue(DerivedRelationalState state) { - return getEntityBinding().getBaseTable().createDerivedValue( state.getFormula() ); - } - - private void initializeSingleValue(SingleValueRelationalState state) { - value = createSingleValue( state ); - } - - private SimpleValue createSingleValue(SingleValueRelationalState state) { - if ( state instanceof ColumnRelationalState ) { - return createColumn( ColumnRelationalState.class.cast( state ) ); - } - else if ( state instanceof DerivedRelationalState ) { - return createDerivedValue( DerivedRelationalState.class.cast( state ) ); - } - else { - throw new MappingException( "unknown relational state:" + state.getClass().getName() ); - } - } - - protected void initializeSimpleTupleValue(SimpleTupleRelationalState state) { - if ( state.getRelationalStates().size() == 0 ) { - throw new MappingException( "Tuple state does not contain any values." ); - } - if ( state.getRelationalStates().size() == 1 ) { - initializeSingleValue( state.getRelationalStates().iterator().next() ); - } - else { - value = createSimpleTupleValue( state ); - } - } - - private Tuple createSimpleTupleValue(SimpleTupleRelationalState state) { - Tuple tuple = getEntityBinding().getBaseTable().createTuple( "[" + getAttribute().getName() + "]" ); - for ( SingleValueRelationalState singleValueState : state.getRelationalStates() ) { - tuple.addValue( createSingleValue( singleValueState ) ); - } - return tuple; + TupleRelationalState tupleRelationalState = TupleRelationalState.class.cast( state ); + return tupleRelationalState.getRelationalStates().size() == 1 ? + tupleRelationalState.getRelationalStates().get( 0 ) : + state; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/AttributeBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/AttributeBinding.java index cac968a6d3..813c0e01cc 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/AttributeBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/AttributeBinding.java @@ -111,37 +111,4 @@ public interface AttributeBinding { public Set getEntityReferencingAttributeBindings(); public void validate(); - - // TODO: where should this RelationalState stuff go??? - - interface RelationalState {} - - interface SingleValueRelationalState extends RelationalState {} - - interface ColumnRelationalState extends SingleValueRelationalState { - NamingStrategy getNamingStrategy(); - String getExplicitColumnName(); - boolean isUnique(); - Size getSize(); - boolean isNullable(); - String getCheckCondition(); - String getDefault(); - String getSqlType(); - String getCustomWriteFragment(); - String getCustomReadFragment(); - String getComment(); - Set getUniqueKeys(); - Set getIndexes(); - } - - interface DerivedRelationalState extends SingleValueRelationalState { - String getFormula(); - } - - interface SimpleTupleRelationalState extends AbstractAttributeBinding.TupleRelationalState { - } - - interface TupleRelationalState extends RelationalState{ - List getRelationalStates(); - } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/CollectionElement.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/CollectionElement.java index 5c6aff76fd..0ffe67b82b 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/CollectionElement.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/CollectionElement.java @@ -24,6 +24,7 @@ package org.hibernate.metamodel.binding; import org.hibernate.metamodel.relational.Value; +import org.hibernate.metamodel.state.domain.CollectionElementDomainState; /** * TODO : javadoc @@ -31,10 +32,6 @@ import org.hibernate.metamodel.relational.Value; * @author Steve Ebersole */ public class CollectionElement { - public static interface DomainState { - HibernateTypeDescriptor getHibernateTypeDescriptor(); - String getNodeName(); - } private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor(); private final PluralAttributeBinding collectionBinding; @@ -47,7 +44,7 @@ public class CollectionElement { this.collectionBinding = collectionBinding; } - public void initialize(DomainState state) { + public void initialize(CollectionElementDomainState state) { hibernateTypeDescriptor.initialize( state.getHibernateTypeDescriptor() ); nodeName = state.getNodeName(); } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/ManyToOneAttributeBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/ManyToOneAttributeBinding.java index fb58189a2e..8eea6ecadd 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/ManyToOneAttributeBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/ManyToOneAttributeBinding.java @@ -30,6 +30,8 @@ import org.hibernate.internal.util.ReflectHelper; import org.hibernate.metamodel.relational.ForeignKey; import org.hibernate.metamodel.relational.SimpleValue; import org.hibernate.metamodel.relational.Column; +import org.hibernate.metamodel.state.domain.ManyToOneAttributeDomainState; +import org.hibernate.metamodel.state.relational.ManyToOneRelationalState; /** * TODO : javadoc @@ -45,23 +47,11 @@ public class ManyToOneAttributeBinding extends SingularAttributeBinding implemen private AttributeBinding referencedAttributeBinding; private boolean ignoreNotFound; - public static interface DomainState extends SingularAttributeBinding.DomainState { - boolean isUnwrapProxy(); - String getReferencedAttributeName(); - String getReferencedEntityName(); - boolean ignoreNotFound(); - } - - public static interface RelationalState extends AttributeBinding.RelationalState { - boolean isLogicalOneToOne(); - String getForeignKeyName(); - } - ManyToOneAttributeBinding(EntityBinding entityBinding) { super( entityBinding, false, false ); } - public final void initialize(DomainState state) { + public final void initialize(ManyToOneAttributeDomainState state) { super.initialize( state ); isPropertyReference = state.getReferencedAttributeName() != null; referencedAttributeName = state.getReferencedAttributeName(); @@ -75,8 +65,8 @@ public class ManyToOneAttributeBinding extends SingularAttributeBinding implemen } } - public final void initialize(RelationalState state) { - super.initialize( state ); + public final void initialize(ManyToOneRelationalState state) { + super.initializeValue( state ); isLogicalOneToOne = state.isLogicalOneToOne(); foreignKeyName = state.getForeignKeyName(); } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/PluralAttributeBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/PluralAttributeBinding.java index 9d597057f4..64ac55a8c5 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/PluralAttributeBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/PluralAttributeBinding.java @@ -26,19 +26,13 @@ package org.hibernate.metamodel.binding; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import org.dom4j.Attribute; -import org.dom4j.Element; import org.jboss.logging.Logger; import org.hibernate.FetchMode; -import org.hibernate.MappingException; import org.hibernate.internal.CoreMessageLogger; import org.hibernate.metamodel.relational.Table; -import org.hibernate.metamodel.source.hbm.HbmHelper; -import org.hibernate.metamodel.source.util.DomHelper; +import org.hibernate.metamodel.state.domain.PluralAttributeDomainState; /** * TODO : javadoc @@ -47,35 +41,6 @@ import org.hibernate.metamodel.source.util.DomHelper; */ public abstract class PluralAttributeBinding extends AbstractAttributeBinding { - public static interface DomainState extends AbstractAttributeBinding.DomainState { - FetchMode getFetchMode(); - boolean isExtraLazy(); - CollectionElement getCollectionElement(PluralAttributeBinding binding); - boolean isInverse(); - boolean isMutable(); - boolean isSubselectLoadable(); - String getCacheConcurrencyStrategy(); - String getCacheRegionName(); - String getOrderBy(); - String getWhere(); - String getReferencedPropertyName(); - boolean isSorted(); - Comparator getComparator(); - String getComparatorClassName(); - boolean isOrphanDelete(); - int getBatchSize(); - boolean isEmbedded(); - boolean isOptimisticLocked(); - Class getCollectionPersisterClass(); - java.util.Map getFilters(); - java.util.Set getSynchronizedTables(); - CustomSQL getCustomSQLInsert(); - CustomSQL getCustomSQLUpdate(); - CustomSQL getCustomSQLDelete(); - CustomSQL getCustomSQLDeleteAll(); - String getLoaderName(); - } - private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, PluralAttributeBinding.class.getName() ); @@ -119,11 +84,12 @@ public abstract class PluralAttributeBinding extends AbstractAttributeBinding { collectionElement = new CollectionElement( this ); } - public void initialize(DomainState state) { + public void initialize(PluralAttributeDomainState state) { super.initialize( state ); fetchMode = state.getFetchMode(); extraLazy = state.isExtraLazy(); - collectionElement = state.getCollectionElement( this ); + collectionElement = new ElementCollectionElement( this ); + collectionElement.initialize( state.getCollectionElementDomainState() ); inverse = state.isInverse(); mutable = state.isMutable(); subselectLoadable = state.isSubselectLoadable(); @@ -152,8 +118,6 @@ public abstract class PluralAttributeBinding extends AbstractAttributeBinding { loaderName = state.getLoaderName(); } - - protected boolean isLazyDefault(MappingDefaults defaults) { return defaults.isDefaultLazy(); } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SimpleAttributeBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SimpleAttributeBinding.java index 39f27f270f..88f57b94e7 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SimpleAttributeBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SimpleAttributeBinding.java @@ -24,6 +24,10 @@ package org.hibernate.metamodel.binding; import org.hibernate.mapping.PropertyGeneration; +import org.hibernate.metamodel.state.domain.SimpleAttributeDomainState; +import org.hibernate.metamodel.state.relational.ColumnRelationalState; +import org.hibernate.metamodel.state.relational.DerivedValueRelationalState; +import org.hibernate.metamodel.state.relational.TupleRelationalState; /** * TODO : javadoc @@ -31,31 +35,27 @@ import org.hibernate.mapping.PropertyGeneration; * @author Steve Ebersole */ public class SimpleAttributeBinding extends SingularAttributeBinding { - public static interface DomainState extends SingularAttributeBinding.DomainState { - public PropertyGeneration getPropertyGeneration(); - } - private PropertyGeneration generation; SimpleAttributeBinding(EntityBinding entityBinding, boolean forceNonNullable, boolean forceUnique) { super( entityBinding, forceNonNullable, forceUnique ); } - public final void initialize(DomainState state) { + public final void initialize(SimpleAttributeDomainState state) { super.initialize( state ); generation = state.getPropertyGeneration(); } public void initializeColumnValue(ColumnRelationalState state) { - super.initializeColumnValue( state ); + super.initializeValue( state ); } - public void initializeDerivedValue(DerivedRelationalState state) { - super.initializeDerivedValue( state ); + public void initializeDerivedValue(DerivedValueRelationalState state) { + super.initializeValue( state ); } - public void initializeSimpleTupleValue(SimpleTupleRelationalState state) { - super.initializeSimpleTupleValue( state ); + public void initializeTupleValue(TupleRelationalState state) { + super.initializeValue( state ); } private boolean isUnique(ColumnRelationalState state) { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SingularAttributeBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SingularAttributeBinding.java index d6e0560eee..24afd97c4b 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SingularAttributeBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/binding/SingularAttributeBinding.java @@ -23,19 +23,14 @@ */ package org.hibernate.metamodel.binding; +import org.hibernate.metamodel.state.domain.SingularAttributeDomainState; + /** * TODO : javadoc * * @author Gail Badner */ public abstract class SingularAttributeBinding extends AbstractAttributeBinding implements KeyValueBinding { - public static interface DomainState extends AbstractAttributeBinding.DomainState { - boolean isInsertable(); - boolean isUpdateable(); - boolean isKeyCasadeDeleteEnabled(); - String getUnsavedValue(); - } - private final boolean forceNonNullable; private final boolean forceUnique; private boolean insertable; @@ -49,7 +44,7 @@ public abstract class SingularAttributeBinding extends AbstractAttributeBinding this.forceUnique = forceUnique; } - public final void initialize(DomainState state) { + public final void initialize(SingularAttributeDomainState state) { super.initialize( state ); insertable = state.isInsertable(); updateable = state.isUpdateable(); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Column.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Column.java index b5e56f488e..1696a57323 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Column.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Column.java @@ -26,7 +26,7 @@ package org.hibernate.metamodel.relational; import java.util.Set; import org.hibernate.cfg.NamingStrategy; -import org.hibernate.metamodel.binding.SimpleAttributeBinding; +import org.hibernate.metamodel.state.relational.ColumnRelationalState; /** * Models a physical column @@ -55,6 +55,26 @@ public class Column extends AbstractSimpleValue implements SimpleValue { this.name = name; } + public void initialize(ColumnRelationalState state, boolean forceNonNullable, boolean forceUnique) { + size.initialize( state.getSize() ); + nullable = ! forceNonNullable && state.isNullable(); + unique = ! forceUnique && state.isUnique(); + checkCondition = state.getCheckCondition(); + defaultValue = state.getDefault(); + sqlType = state.getSqlType(); + + // TODO: this should go into binding instead (I think???) + writeFragment = state.getCustomWriteFragment(); + readFragment = state.getCustomReadFragment(); + comment = state.getComment(); + for ( String uniqueKey : state.getUniqueKeys() ) { + getTable().getOrCreateUniqueKey( uniqueKey ).addColumn( this ); + } + for ( String index : state.getIndexes() ) { + getTable().getOrCreateIndex( index ).addColumn( this ); + } + } + public String getName() { return name; } @@ -135,5 +155,4 @@ public class Column extends AbstractSimpleValue implements SimpleValue { public String toLoggableString() { return getTable().getLoggableValueQualifier() + '.' + getName(); } - } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Value.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Value.java index 6b89b30a92..0549bb7cc1 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Value.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Value.java @@ -75,4 +75,5 @@ public interface Value { * @throws org.hibernate.metamodel.ValidationException if validaton fails. */ public void validateJdbcTypes(JdbcCodes typeCodes); + } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ValueFactory.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ValueFactory.java new file mode 100644 index 0000000000..c0f5129a99 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ValueFactory.java @@ -0,0 +1,126 @@ +/* + * 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.relational; + +import org.hibernate.MappingException; +import org.hibernate.metamodel.state.relational.ColumnRelationalState; +import org.hibernate.metamodel.state.relational.DerivedValueRelationalState; +import org.hibernate.metamodel.state.relational.ValueRelationalState; +import org.hibernate.metamodel.state.relational.SimpleValueRelationalState; +import org.hibernate.metamodel.state.relational.TupleRelationalState; + +/** + * @author Gail Badner + */ +public class ValueFactory { + + public static Column createColumn(TableSpecification table, + String attributeName, + ColumnRelationalState state, + boolean forceNonNullable, + boolean forceUnique + ) { + final String explicitName = state.getExplicitColumnName(); + final String logicalColumnName = state.getNamingStrategy().logicalColumnName( explicitName, attributeName ); + final String columnName = + explicitName == null ? + state.getNamingStrategy().propertyToColumnName( attributeName ) : + state.getNamingStrategy().columnName( explicitName ); +// todo : find out the purpose of these logical bindings +// mappings.addColumnBinding( logicalColumnName, column, table ); + + if ( columnName == null ) { + throw new IllegalArgumentException( "columnName must be non-null." ); + } + Column value = table.createColumn( columnName ); + value.initialize( state, forceNonNullable, forceUnique ); + return value; + } + + public static DerivedValue createDerivedValue(TableSpecification table, + DerivedValueRelationalState state) { + return table.createDerivedValue( state.getFormula() ); + } + + public static SimpleValue createSimpleValue(TableSpecification table, + String attributeName, + SimpleValueRelationalState state, + boolean forceNonNullable, + boolean forceUnique + ) { + if ( state instanceof ColumnRelationalState ) { + ColumnRelationalState columnRelationalState = ColumnRelationalState.class.cast( state ); + return createColumn( table, attributeName, columnRelationalState, forceNonNullable, forceUnique ); + } + else if ( state instanceof DerivedValueRelationalState ) { + return createDerivedValue( table, DerivedValueRelationalState.class.cast( state ) ); + } + else { + throw new MappingException( "unknown relational state:" + state.getClass().getName() ); + } + } + + public static Tuple createTuple(TableSpecification table, + String attributeName, + TupleRelationalState state, + boolean forceNonNullable, + boolean forceUnique + ) { + Tuple tuple = table.createTuple( "[" + attributeName + "]" ); + for ( SimpleValueRelationalState valueState : state.getRelationalStates() ) { + tuple.addValue( createSimpleValue( table, attributeName, valueState, forceNonNullable, forceUnique ) ); + } + return tuple; + } + + public static Value createValue(TableSpecification table, + String attributeName, + ValueRelationalState state, + boolean forceNonNullable, + boolean forceUnique) { + Value value = null; + if ( SimpleValueRelationalState.class.isInstance( state ) ) { + value = createSimpleValue( + table, + attributeName, + SimpleValueRelationalState.class.cast( state ), + forceNonNullable, + forceUnique + ); + } + else if ( TupleRelationalState.class.isInstance( state ) ) { + value = createTuple( + table, + attributeName, + TupleRelationalState.class.cast( state ), + forceNonNullable, + forceUnique + ); + } + else { + throw new MappingException( "Unexpected type of RelationalState" + state.getClass().getName() ); + } + return value; + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EntityBinder.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EntityBinder.java index bc98115c5a..40ffde4883 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EntityBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/EntityBinder.java @@ -213,7 +213,7 @@ public class EntityBinder { AttributeColumnRelationalState columnRelationsState = new AttributeColumnRelationalState( idAttribute, meta ); AttributeTupleRelationalState relationalState = new AttributeTupleRelationalState(); relationalState.addValueState( columnRelationsState ); - idBinding.initializeSimpleTupleValue( relationalState ); + idBinding.initializeTupleValue( relationalState ); } private void bindAttributes(EntityBinding entityBinding) { @@ -241,7 +241,7 @@ public class EntityBinder { ); AttributeTupleRelationalState relationalState = new AttributeTupleRelationalState(); relationalState.addValueState( columnRelationsState ); - attributeBinding.initializeSimpleTupleValue( relationalState ); + attributeBinding.initializeTupleValue( relationalState ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/domain/AttributeDomainState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/domain/AttributeDomainState.java index fbad69cdbe..955e07db4f 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/domain/AttributeDomainState.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/domain/AttributeDomainState.java @@ -5,16 +5,16 @@ import java.util.Map; import org.hibernate.mapping.PropertyGeneration; import org.hibernate.metamodel.binding.EntityBinding; import org.hibernate.metamodel.binding.HibernateTypeDescriptor; -import org.hibernate.metamodel.binding.SimpleAttributeBinding; import org.hibernate.metamodel.domain.Attribute; import org.hibernate.metamodel.domain.Entity; import org.hibernate.metamodel.domain.MetaAttribute; +import org.hibernate.metamodel.state.domain.SimpleAttributeDomainState; import org.hibernate.metamodel.source.annotations.MappedAttribute; /** * @author Hardy Ferentschik */ -public class AttributeDomainState implements SimpleAttributeBinding.DomainState { +public class AttributeDomainState implements SimpleAttributeDomainState { private final PropertyGeneration propertyGeneration = null; private final HibernateTypeDescriptor typeDescriptor; private final Attribute attribute; @@ -101,7 +101,7 @@ public class AttributeDomainState implements SimpleAttributeBinding.DomainState } @Override - public Map getMetaAttributes(EntityBinding entityBinding) { + public Map getMetaAttributes() { return null; //To change body of implemented methods use File | Settings | File Templates. } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/relational/AttributeColumnRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/relational/AttributeColumnRelationalState.java index 972437bc40..1a86766c44 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/relational/AttributeColumnRelationalState.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/relational/AttributeColumnRelationalState.java @@ -33,17 +33,18 @@ import org.jboss.jandex.AnnotationInstance; import org.hibernate.AnnotationException; import org.hibernate.cfg.NamingStrategy; -import org.hibernate.metamodel.binding.SimpleAttributeBinding; +import org.hibernate.metamodel.relational.Column; import org.hibernate.metamodel.relational.Size; import org.hibernate.metamodel.source.annotations.ColumnValues; import org.hibernate.metamodel.source.annotations.HibernateDotNames; import org.hibernate.metamodel.source.annotations.MappedAttribute; import org.hibernate.metamodel.source.internal.MetadataImpl; +import org.hibernate.metamodel.state.relational.ColumnRelationalState; /** * @author Hardy Ferentschik */ -public class AttributeColumnRelationalState implements SimpleAttributeBinding.ColumnRelationalState { +public class AttributeColumnRelationalState implements ColumnRelationalState { private final NamingStrategy namingStrategy; private final String columnName; private final boolean unique; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/relational/AttributeTupleRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/relational/AttributeTupleRelationalState.java index fa18d739d2..946bca056c 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/relational/AttributeTupleRelationalState.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/state/relational/AttributeTupleRelationalState.java @@ -26,21 +26,21 @@ package org.hibernate.metamodel.source.annotations.state.relational; import java.util.ArrayList; import java.util.List; -import org.hibernate.metamodel.binding.AttributeBinding; -import org.hibernate.metamodel.binding.SimpleAttributeBinding; +import org.hibernate.metamodel.state.relational.SimpleValueRelationalState; +import org.hibernate.metamodel.state.relational.TupleRelationalState; /** * @author Hardy Ferentschik */ -public class AttributeTupleRelationalState implements SimpleAttributeBinding.SimpleTupleRelationalState { - List valueStates = new ArrayList(); +public class AttributeTupleRelationalState implements TupleRelationalState { + List valueStates = new ArrayList(); - public void addValueState(AttributeBinding.SingleValueRelationalState state) { + public void addValueState(SimpleValueRelationalState state) { valueStates.add( state ); } @Override - public List getRelationalStates() { + public List getRelationalStates() { return valueStates; } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/AbstractEntityBinder.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/AbstractEntityBinder.java index 1a6fc2c40e..cb442ed7dc 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/AbstractEntityBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/AbstractEntityBinder.java @@ -435,7 +435,7 @@ PrimitiveArray if ( attributeBinding.getValue() == null ) { // relational model has not been bound yet // boolean (true here) indicates that by default column names should be guessed - attributeBinding.initializeSimpleTupleValue( + attributeBinding.initializeTupleValue( new HbmSimpleValueRelationalStateContainer( getHibernateMappingBinder(), true, @@ -463,7 +463,7 @@ PrimitiveArray if ( attributeBinding.getValue() == null ) { // relational model has not been bound yet // boolean (true here) indicates that by default column names should be guessed - attributeBinding.initializeSimpleTupleValue( + attributeBinding.initializeTupleValue( new HbmSimpleValueRelationalStateContainer( getHibernateMappingBinder(), true, @@ -491,7 +491,7 @@ PrimitiveArray if ( attributeBinding.getValue() == null ) { // relational model has not been bound yet // boolean (true here) indicates that by default column names should be guessed - attributeBinding.initializeSimpleTupleValue( + attributeBinding.initializeTupleValue( new HbmSimpleValueRelationalStateContainer( getHibernateMappingBinder(), true, @@ -519,7 +519,7 @@ PrimitiveArray if ( attributeBinding.getValue() == null ) { // relational model has not been bound yet // boolean (true here) indicates that by default column names should be guessed - attributeBinding.initializeSimpleTupleValue( + attributeBinding.initializeTupleValue( new HbmSimpleValueRelationalStateContainer( getHibernateMappingBinder(), true, @@ -546,7 +546,7 @@ PrimitiveArray if ( attributeBinding.getValue() == null ) { // relational model has not been bound yet // boolean (true here) indicates that by default column names should be guessed - attributeBinding.initializeSimpleTupleValue( + attributeBinding.initializeTupleValue( new HbmSimpleValueRelationalStateContainer( getHibernateMappingBinder(), true, diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/AbstractHbmAttributeDomainState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/AbstractHbmAttributeDomainState.java index 096b27d9dd..15a7860dc6 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/AbstractHbmAttributeDomainState.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/AbstractHbmAttributeDomainState.java @@ -25,17 +25,16 @@ package org.hibernate.metamodel.source.hbm.state.domain; import java.util.Map; -import org.hibernate.metamodel.binding.AbstractAttributeBinding; -import org.hibernate.metamodel.binding.EntityBinding; import org.hibernate.metamodel.binding.MappingDefaults; import org.hibernate.metamodel.domain.Attribute; import org.hibernate.metamodel.domain.MetaAttribute; import org.hibernate.metamodel.source.util.MappingHelper; +import org.hibernate.metamodel.state.domain.AttributeDomainState; /** * @author Gail Badner */ -public abstract class AbstractHbmAttributeDomainState implements AbstractAttributeBinding.DomainState { +public abstract class AbstractHbmAttributeDomainState implements AttributeDomainState { private final MappingDefaults defaults; private final Attribute attribute; private final String nodeName; @@ -78,7 +77,7 @@ public abstract class AbstractHbmAttributeDomainState implements AbstractAttribu return nodeName; } - public final Map getMetaAttributes(EntityBinding entityBinding) { + public final Map getMetaAttributes() { return metaAttributes; } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmCollectionElementDomainState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmCollectionElementDomainState.java index 5706ffd7bb..539d23e9e0 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmCollectionElementDomainState.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmCollectionElementDomainState.java @@ -26,11 +26,12 @@ package org.hibernate.metamodel.source.hbm.state.domain; import org.hibernate.metamodel.binding.CollectionElement; import org.hibernate.metamodel.binding.HibernateTypeDescriptor; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLElementElement; +import org.hibernate.metamodel.state.domain.CollectionElementDomainState; /** * @author Gail Badner */ -public class HbmCollectionElementDomainState implements CollectionElement.DomainState { +public class HbmCollectionElementDomainState implements CollectionElementDomainState { private final XMLElementElement element; HbmCollectionElementDomainState(XMLElementElement element) { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmManyToOneAttributeDomainState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmManyToOneAttributeDomainState.java index a796abd9ae..9e5af59a3e 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmManyToOneAttributeDomainState.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmManyToOneAttributeDomainState.java @@ -33,13 +33,14 @@ import org.hibernate.metamodel.domain.MetaAttribute; import org.hibernate.metamodel.source.hbm.HbmHelper; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLManyToOneElement; import org.hibernate.metamodel.source.util.MappingHelper; +import org.hibernate.metamodel.state.domain.ManyToOneAttributeDomainState; /** * @author Gail Badner */ public class HbmManyToOneAttributeDomainState extends AbstractHbmAttributeDomainState - implements ManyToOneAttributeBinding.DomainState { + implements ManyToOneAttributeDomainState { private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor(); private final FetchMode fetchMode; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmPluralAttributeDomainState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmPluralAttributeDomainState.java index 4728b5c531..dfa75068b6 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmPluralAttributeDomainState.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmPluralAttributeDomainState.java @@ -30,12 +30,10 @@ import java.util.Map; import org.hibernate.FetchMode; import org.hibernate.MappingException; -import org.hibernate.metamodel.binding.CollectionElement; import org.hibernate.metamodel.binding.CustomSQL; import org.hibernate.metamodel.binding.ElementCollectionElement; import org.hibernate.metamodel.binding.HibernateTypeDescriptor; import org.hibernate.metamodel.binding.MappingDefaults; -import org.hibernate.metamodel.binding.PluralAttributeBinding; import org.hibernate.metamodel.domain.Attribute; import org.hibernate.metamodel.domain.MetaAttribute; import org.hibernate.metamodel.source.hbm.HbmHelper; @@ -47,12 +45,14 @@ import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlUpdateElement; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSynchronizeElement; import org.hibernate.metamodel.source.util.MappingHelper; +import org.hibernate.metamodel.state.domain.CollectionElementDomainState; +import org.hibernate.metamodel.state.domain.PluralAttributeDomainState; /** * @author Gail Badner */ -public class HbmPluralAttributeDomainState extends AbstractHbmAttributeDomainState implements PluralAttributeBinding.DomainState { +public class HbmPluralAttributeDomainState extends AbstractHbmAttributeDomainState implements PluralAttributeDomainState { private final XMLBagElement collection; private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor(); private final String cascade; @@ -121,10 +121,8 @@ public class HbmPluralAttributeDomainState extends AbstractHbmAttributeDomainSta return ( "extra".equals( collection.getLazy() ) ); } - public CollectionElement getCollectionElement(PluralAttributeBinding binding) { - ElementCollectionElement collectionElement = new ElementCollectionElement( binding ); - collectionElement.initialize( new HbmCollectionElementDomainState( collection.getElement() ) ); - return collectionElement; + public CollectionElementDomainState getCollectionElementDomainState() { + return new HbmCollectionElementDomainState( collection.getElement() ); } public boolean isInverse() { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmSimpleAttributeDomainState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmSimpleAttributeDomainState.java index 0a3e4f906c..c619e620d1 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmSimpleAttributeDomainState.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/domain/HbmSimpleAttributeDomainState.java @@ -29,7 +29,6 @@ import org.hibernate.MappingException; import org.hibernate.mapping.PropertyGeneration; import org.hibernate.metamodel.binding.HibernateTypeDescriptor; import org.hibernate.metamodel.binding.MappingDefaults; -import org.hibernate.metamodel.binding.SimpleAttributeBinding; import org.hibernate.metamodel.domain.MetaAttribute; import org.hibernate.metamodel.source.hbm.HbmHelper; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLDiscriminator; @@ -38,11 +37,12 @@ import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLCla import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLVersion; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertyElement; import org.hibernate.metamodel.source.util.MappingHelper; +import org.hibernate.metamodel.state.domain.SimpleAttributeDomainState; /** * @author Gail Badner */ -public class HbmSimpleAttributeDomainState extends AbstractHbmAttributeDomainState implements SimpleAttributeBinding.DomainState { +public class HbmSimpleAttributeDomainState extends AbstractHbmAttributeDomainState implements SimpleAttributeDomainState { private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor(); private final boolean isLazy; private final PropertyGeneration propertyGeneration; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmColumnRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmColumnRelationalState.java index f7ad3eb722..7cd3526829 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmColumnRelationalState.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmColumnRelationalState.java @@ -27,7 +27,6 @@ import java.util.Set; import org.hibernate.MappingException; import org.hibernate.cfg.NamingStrategy; -import org.hibernate.metamodel.binding.AbstractAttributeBinding; import org.hibernate.metamodel.relational.Size; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLColumnElement; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLDiscriminator; @@ -37,13 +36,14 @@ import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLCla import org.hibernate.metamodel.source.hbm.xml.mapping.XMLManyToOneElement; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertyElement; import org.hibernate.metamodel.source.util.MappingHelper; +import org.hibernate.metamodel.state.relational.ColumnRelationalState; // TODO: remove duplication after Id, Discriminator, Version, Timestamp, and Property extend a common interface. /** * @author Gail Badner */ -public class HbmColumnRelationalState implements AbstractAttributeBinding.ColumnRelationalState { +public class HbmColumnRelationalState implements ColumnRelationalState { private final HbmSimpleValueRelationalStateContainer container; private final String explicitColumnName; private final Size size; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmDerivedValueRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmDerivedValueRelationalState.java index 59e2e652c9..8c92cb6189 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmDerivedValueRelationalState.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmDerivedValueRelationalState.java @@ -23,12 +23,12 @@ */ package org.hibernate.metamodel.source.hbm.state.relational; -import org.hibernate.metamodel.binding.SimpleAttributeBinding; +import org.hibernate.metamodel.state.relational.DerivedValueRelationalState; /** * @author Gail Badner */ -public class HbmDerivedValueRelationalState implements SimpleAttributeBinding.DerivedRelationalState { +public class HbmDerivedValueRelationalState implements DerivedValueRelationalState { private final String formula; public HbmDerivedValueRelationalState(String formula) { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmManyToOneRelationalStateContainer.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmManyToOneRelationalStateContainer.java index 2048396302..b6f4032dd9 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmManyToOneRelationalStateContainer.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmManyToOneRelationalStateContainer.java @@ -23,15 +23,15 @@ */ package org.hibernate.metamodel.source.hbm.state.relational; -import org.hibernate.metamodel.binding.ManyToOneAttributeBinding; import org.hibernate.metamodel.binding.MappingDefaults; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLManyToOneElement; +import org.hibernate.metamodel.state.relational.ManyToOneRelationalState; /** * @author Gail Badner */ public class HbmManyToOneRelationalStateContainer extends HbmSimpleValueRelationalStateContainer -implements ManyToOneAttributeBinding.RelationalState { +implements ManyToOneRelationalState { private final boolean isLogicalOneToOne; private final String foreignKeyName; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmSimpleValueRelationalStateContainer.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmSimpleValueRelationalStateContainer.java index b71ca3330b..c20b811b64 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmSimpleValueRelationalStateContainer.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/state/relational/HbmSimpleValueRelationalStateContainer.java @@ -25,17 +25,13 @@ package org.hibernate.metamodel.source.hbm.state.relational; import java.util.ArrayList; import java.util.Collections; -import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import org.hibernate.MappingException; import org.hibernate.cfg.NamingStrategy; -import org.hibernate.metamodel.binding.AbstractAttributeBinding; -import org.hibernate.metamodel.binding.AttributeBinding; import org.hibernate.metamodel.binding.HibernateTypeDescriptor; import org.hibernate.metamodel.binding.MappingDefaults; -import org.hibernate.metamodel.binding.SimpleAttributeBinding; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLColumnElement; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLDiscriminator; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLId; @@ -43,15 +39,17 @@ import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLCla import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLVersion; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLManyToOneElement; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertyElement; +import org.hibernate.metamodel.state.relational.SimpleValueRelationalState; +import org.hibernate.metamodel.state.relational.TupleRelationalState; /** * @author Gail Badner */ -public class HbmSimpleValueRelationalStateContainer implements AbstractAttributeBinding.SimpleTupleRelationalState { +public class HbmSimpleValueRelationalStateContainer implements TupleRelationalState { private final MappingDefaults defaults; private final Set propertyUniqueKeys; private final Set propertyIndexes; - private final List singleValueStates; + private final List simpleValueStates; private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor(); public NamingStrategy getNamingStrategy() { @@ -64,11 +62,11 @@ public class HbmSimpleValueRelationalStateContainer implements AbstractAttribute boolean autoColumnCreation, XMLId id) { this( defaults, id.getColumn() ); - if ( singleValueStates.isEmpty() ) { + if ( simpleValueStates.isEmpty() ) { if ( id.getColumn() == null && ! autoColumnCreation ) { throw new MappingException( "No columns to map and auto column creation is disabled." ); } - singleValueStates.add( new HbmColumnRelationalState( id, this ) ); + simpleValueStates.add( new HbmColumnRelationalState( id, this ) ); } else if ( id.getColumn() != null ) { throw new MappingException( "column attribute may not be used together with subelement" ); @@ -80,11 +78,11 @@ public class HbmSimpleValueRelationalStateContainer implements AbstractAttribute boolean autoColumnCreation, XMLDiscriminator discriminator) { this( defaults, discriminator.getFormula(), discriminator.getColumn() ); - if ( singleValueStates.isEmpty() ) { + if ( simpleValueStates.isEmpty() ) { if ( discriminator.getColumn() == null && discriminator.getFormula() == null && ! autoColumnCreation ) { throw new MappingException( "No column or formula to map and auto column creation is disabled." ); } - singleValueStates.add( new HbmColumnRelationalState( discriminator, this ) ); + simpleValueStates.add( new HbmColumnRelationalState( discriminator, this ) ); } else if ( discriminator.getColumn() != null || discriminator.getFormula() != null) { throw new MappingException( "column/formula attribute may not be used together with / subelement" ); @@ -96,11 +94,11 @@ public class HbmSimpleValueRelationalStateContainer implements AbstractAttribute boolean autoColumnCreation, XMLVersion version) { this( defaults, version.getColumn() ); - if ( singleValueStates.isEmpty() ) { + if ( simpleValueStates.isEmpty() ) { if ( version.getColumn() == null && ! autoColumnCreation ) { throw new MappingException( "No column or formula to map and auto column creation is disabled." ); } - singleValueStates.add( new HbmColumnRelationalState( version, this ) ); + simpleValueStates.add( new HbmColumnRelationalState( version, this ) ); } else if ( version.getColumn() != null ) { throw new MappingException( "column attribute may not be used together with subelement" ); @@ -112,11 +110,11 @@ public class HbmSimpleValueRelationalStateContainer implements AbstractAttribute boolean autoColumnCreation, XMLTimestamp timestamp) { this( defaults, null ); - if ( singleValueStates.isEmpty() ) { + if ( simpleValueStates.isEmpty() ) { if ( timestamp.getColumn() == null && ! autoColumnCreation ) { throw new MappingException( "No columns to map and auto column creation is disabled." ); } - singleValueStates.add( new HbmColumnRelationalState( timestamp, this ) ); + simpleValueStates.add( new HbmColumnRelationalState( timestamp, this ) ); } else if ( timestamp.getColumn() != null ) { throw new MappingException( "column attribute may not be used together with subelement" ); @@ -128,11 +126,11 @@ public class HbmSimpleValueRelationalStateContainer implements AbstractAttribute boolean autoColumnCreation, XMLPropertyElement property) { this( defaults, property.getColumnOrFormula() ); - if ( singleValueStates.isEmpty() ) { + if ( simpleValueStates.isEmpty() ) { if ( property.getColumn() == null && property.getFormula() == null && ! autoColumnCreation ) { throw new MappingException( "No column or formula to map and auto column creation is disabled." ); } - singleValueStates.add( new HbmColumnRelationalState( property, this ) ); + simpleValueStates.add( new HbmColumnRelationalState( property, this ) ); } else if ( property.getColumn() != null || property.getFormula() != null) { throw new MappingException( "column/formula attribute may not be used together with / subelement" ); @@ -144,11 +142,11 @@ public class HbmSimpleValueRelationalStateContainer implements AbstractAttribute boolean autoColumnCreation, XMLManyToOneElement manyToOne) { this( defaults, manyToOne.getColumnOrFormula() ); - if ( singleValueStates.isEmpty() ) { + if ( simpleValueStates.isEmpty() ) { if ( manyToOne.getColumn() == null && manyToOne.getFormula() == null && ! autoColumnCreation ) { throw new MappingException( "No column or formula to map and auto column creation is disabled." ); } - singleValueStates.add( new HbmColumnRelationalState( manyToOne, this ) ); + simpleValueStates.add( new HbmColumnRelationalState( manyToOne, this ) ); } else if ( manyToOne.getColumn() != null || manyToOne.getFormula() != null) { throw new MappingException( "column/formula attribute may not be used together with / subelement" ); @@ -171,19 +169,19 @@ public class HbmSimpleValueRelationalStateContainer implements AbstractAttribute this.defaults = defaults; this.propertyUniqueKeys = Collections.emptySet(); this.propertyIndexes = Collections.emptySet(); - singleValueStates = new ArrayList( + simpleValueStates = new ArrayList( mappedColumnsOrFormulas == null || mappedColumnsOrFormulas.isEmpty() ? 1 : mappedColumnsOrFormulas.size() ); if ( mappedColumnsOrFormulas != null && ! mappedColumnsOrFormulas.isEmpty() ) { for ( Object mappedColumnOrFormula : mappedColumnsOrFormulas ) { - singleValueStates.add( createColumnOrFormulaRelationalState( this, mappedColumnOrFormula ) ); + simpleValueStates.add( createColumnOrFormulaRelationalState( this, mappedColumnOrFormula ) ); } } } - private static AttributeBinding.SingleValueRelationalState createColumnOrFormulaRelationalState( + private static SimpleValueRelationalState createColumnOrFormulaRelationalState( HbmSimpleValueRelationalStateContainer container, Object columnOrFormula) { if ( XMLColumnElement.class.isInstance( columnOrFormula ) ) { @@ -198,8 +196,8 @@ public class HbmSimpleValueRelationalStateContainer implements AbstractAttribute throw new MappingException( "unknown type of column or formula: " + columnOrFormula.getClass().getName() ); } - public List getRelationalStates() { - return singleValueStates; + public List getRelationalStates() { + return simpleValueStates; } Set getPropertyUniqueKeys() { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/AttributeDomainState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/AttributeDomainState.java new file mode 100644 index 0000000000..0241b8a2e7 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/AttributeDomainState.java @@ -0,0 +1,45 @@ +/* + * 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.state.domain; + +import java.util.Map; + +import org.hibernate.metamodel.binding.HibernateTypeDescriptor; +import org.hibernate.metamodel.domain.Attribute; +import org.hibernate.metamodel.domain.MetaAttribute; + +/** + * @author Gail Badner + */ +public interface AttributeDomainState { + HibernateTypeDescriptor getHibernateTypeDescriptor(); + Attribute getAttribute(); + boolean isLazy(); + String getPropertyAccessorName(); + boolean isAlternateUniqueKey(); + String getCascade(); + boolean isOptimisticLockable(); + String getNodeName(); + Map getMetaAttributes(); +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/CollectionElementDomainState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/CollectionElementDomainState.java new file mode 100644 index 0000000000..b3dd653c6d --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/CollectionElementDomainState.java @@ -0,0 +1,34 @@ +/* + * 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.state.domain; + +import org.hibernate.metamodel.binding.HibernateTypeDescriptor; + +/** + * @author Gail Badner + */ +public interface CollectionElementDomainState { + HibernateTypeDescriptor getHibernateTypeDescriptor(); + String getNodeName(); +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/ManyToOneAttributeDomainState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/ManyToOneAttributeDomainState.java new file mode 100644 index 0000000000..77bc88d452 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/ManyToOneAttributeDomainState.java @@ -0,0 +1,34 @@ +/* + * 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.state.domain; + +/** + * @author Gail Badner + */ +public interface ManyToOneAttributeDomainState extends SingularAttributeDomainState { + boolean isUnwrapProxy(); + String getReferencedAttributeName(); + String getReferencedEntityName(); + boolean ignoreNotFound(); +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/PluralAttributeDomainState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/PluralAttributeDomainState.java new file mode 100644 index 0000000000..21477d46db --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/PluralAttributeDomainState.java @@ -0,0 +1,68 @@ +/* + * 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.state.domain; + +import java.util.Comparator; + +import org.hibernate.FetchMode; +import org.hibernate.metamodel.binding.AbstractAttributeBinding; +import org.hibernate.metamodel.binding.CollectionElement; +import org.hibernate.metamodel.binding.CustomSQL; +import org.hibernate.metamodel.binding.PluralAttributeBinding; + +/** + * Created by IntelliJ IDEA. + * User: gbadner + * Date: 5/9/11 + * Time: 4:49 PM + * To change this template use File | Settings | File Templates. + */ +public interface PluralAttributeDomainState extends AttributeDomainState { + FetchMode getFetchMode(); + boolean isExtraLazy(); + CollectionElementDomainState getCollectionElementDomainState(); + boolean isInverse(); + boolean isMutable(); + boolean isSubselectLoadable(); + String getCacheConcurrencyStrategy(); + String getCacheRegionName(); + String getOrderBy(); + String getWhere(); + String getReferencedPropertyName(); + boolean isSorted(); + Comparator getComparator(); + String getComparatorClassName(); + boolean isOrphanDelete(); + int getBatchSize(); + boolean isEmbedded(); + boolean isOptimisticLocked(); + Class getCollectionPersisterClass(); + java.util.Map getFilters(); + java.util.Set getSynchronizedTables(); + CustomSQL getCustomSQLInsert(); + CustomSQL getCustomSQLUpdate(); + CustomSQL getCustomSQLDelete(); + CustomSQL getCustomSQLDeleteAll(); + String getLoaderName(); +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/SimpleAttributeDomainState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/SimpleAttributeDomainState.java new file mode 100644 index 0000000000..1a3b455fcc --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/SimpleAttributeDomainState.java @@ -0,0 +1,34 @@ +/* + * 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.state.domain; + +import org.hibernate.mapping.PropertyGeneration; +import org.hibernate.metamodel.binding.SingularAttributeBinding; + +/** + * @author Gail Badner + */ +public interface SimpleAttributeDomainState extends SingularAttributeDomainState { + public PropertyGeneration getPropertyGeneration(); +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/SingularAttributeDomainState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/SingularAttributeDomainState.java new file mode 100644 index 0000000000..d88724b311 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/state/domain/SingularAttributeDomainState.java @@ -0,0 +1,34 @@ +/* + * 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.state.domain; + +/** + * @author Gail Badner + */ +public interface SingularAttributeDomainState extends AttributeDomainState{ + boolean isInsertable(); + boolean isUpdateable(); + boolean isKeyCasadeDeleteEnabled(); + String getUnsavedValue(); +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/ColumnRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/ColumnRelationalState.java new file mode 100644 index 0000000000..cbf465f2c4 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/ColumnRelationalState.java @@ -0,0 +1,48 @@ +/* + * 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.state.relational; + +import java.util.Set; + +import org.hibernate.cfg.NamingStrategy; +import org.hibernate.metamodel.relational.Size; + +/** + * @author Gail Badner + */ +public interface ColumnRelationalState extends SimpleValueRelationalState { + NamingStrategy getNamingStrategy(); + String getExplicitColumnName(); + boolean isUnique(); + Size getSize(); + boolean isNullable(); + String getCheckCondition(); + String getDefault(); + String getSqlType(); + String getCustomWriteFragment(); + String getCustomReadFragment(); + String getComment(); + Set getUniqueKeys(); + Set getIndexes(); +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/DerivedValueRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/DerivedValueRelationalState.java new file mode 100644 index 0000000000..1a3aba9166 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/DerivedValueRelationalState.java @@ -0,0 +1,37 @@ +/* + * 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.state.relational; + +import org.hibernate.metamodel.relational.SimpleValue; + +/** + * Created by IntelliJ IDEA. + * User: gbadner + * Date: 5/9/11 + * Time: 2:15 PM + * To change this template use File | Settings | File Templates. + */ +public interface DerivedValueRelationalState extends SimpleValueRelationalState { + String getFormula(); +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/ManyToOneRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/ManyToOneRelationalState.java new file mode 100644 index 0000000000..f7d4a7401f --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/ManyToOneRelationalState.java @@ -0,0 +1,32 @@ +/* + * 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.state.relational; + +/** + * @author Gail Badner + */ +public interface ManyToOneRelationalState extends ValueRelationalState { + boolean isLogicalOneToOne(); + String getForeignKeyName(); +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/SimpleValueRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/SimpleValueRelationalState.java new file mode 100644 index 0000000000..ff38ba96f0 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/SimpleValueRelationalState.java @@ -0,0 +1,30 @@ +/* + * 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.state.relational; + +/** + * @author Gail Badner + */ +public interface SimpleValueRelationalState extends ValueRelationalState { +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/TupleRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/TupleRelationalState.java new file mode 100644 index 0000000000..f52bc76557 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/TupleRelationalState.java @@ -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.state.relational; + +import java.util.List; + +/** + * @author Gail Badner + */ +public interface TupleRelationalState extends ValueRelationalState { + List getRelationalStates(); +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/ValueRelationalState.java b/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/ValueRelationalState.java new file mode 100644 index 0000000000..23fbcf4e97 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/state/relational/ValueRelationalState.java @@ -0,0 +1,30 @@ +/* + * 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.state.relational; + +/** + * @author Gail Badner + */ +public interface ValueRelationalState { +}