HHH-6213 : Move domain and relational state interfaces into org.hibernate.metamodel.state
This commit is contained in:
parent
66a641df05
commit
e98b3ac727
|
@ -30,7 +30,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
|
||||||
import org.hibernate.metamodel.domain.Attribute;
|
import org.hibernate.metamodel.domain.Attribute;
|
||||||
import org.hibernate.metamodel.domain.MetaAttribute;
|
import org.hibernate.metamodel.domain.MetaAttribute;
|
||||||
import org.hibernate.metamodel.relational.Column;
|
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.TableSpecification;
|
||||||
import org.hibernate.metamodel.relational.Tuple;
|
import org.hibernate.metamodel.relational.Tuple;
|
||||||
import org.hibernate.metamodel.relational.Value;
|
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
|
* TODO : javadoc
|
||||||
|
@ -46,17 +49,6 @@ import org.hibernate.metamodel.relational.Value;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractAttributeBinding implements AttributeBinding {
|
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<String, MetaAttribute> getMetaAttributes(EntityBinding entityBinding);
|
|
||||||
}
|
|
||||||
|
|
||||||
private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
||||||
private final EntityBinding entityBinding;
|
private final EntityBinding entityBinding;
|
||||||
|
@ -81,7 +73,7 @@ public abstract class AbstractAttributeBinding implements AttributeBinding {
|
||||||
this.entityBinding = entityBinding;
|
this.entityBinding = entityBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initialize(DomainState state) {
|
protected void initialize(AttributeDomainState state) {
|
||||||
hibernateTypeDescriptor.initialize( state.getHibernateTypeDescriptor() );
|
hibernateTypeDescriptor.initialize( state.getHibernateTypeDescriptor() );
|
||||||
attribute = state.getAttribute();
|
attribute = state.getAttribute();
|
||||||
isLazy = state.isLazy();
|
isLazy = state.isLazy();
|
||||||
|
@ -90,7 +82,7 @@ public abstract class AbstractAttributeBinding implements AttributeBinding {
|
||||||
cascade = state.getCascade();
|
cascade = state.getCascade();
|
||||||
optimisticLockable = state.isOptimisticLockable();
|
optimisticLockable = state.isOptimisticLockable();
|
||||||
nodeName = state.getNodeName();
|
nodeName = state.getNodeName();
|
||||||
metaAttributes = state.getMetaAttributes( entityBinding );
|
metaAttributes = state.getMetaAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -115,94 +107,24 @@ public abstract class AbstractAttributeBinding implements AttributeBinding {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initializeColumnValue(ColumnRelationalState state) {
|
protected void initializeValue(ValueRelationalState state) {
|
||||||
value = createColumn( state );
|
value = ValueFactory.createValue( getEntityBinding().getBaseTable(),
|
||||||
|
getAttribute().getName(),
|
||||||
|
convertToSimpleRelationalStateIfPossible( state ),
|
||||||
|
forceNonNullable(),
|
||||||
|
forceUnique()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Column createColumn(ColumnRelationalState state) {
|
// TODO: should a single-valued tuple always be converted???
|
||||||
final String explicitName = state.getExplicitColumnName();
|
protected ValueRelationalState convertToSimpleRelationalStateIfPossible(ValueRelationalState state) {
|
||||||
final String logicalColumnName = state.getNamingStrategy().logicalColumnName( explicitName, getAttribute().getName() );
|
if ( !TupleRelationalState.class.isInstance( state ) ) {
|
||||||
final TableSpecification table = getEntityBinding().getBaseTable();
|
return state;
|
||||||
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 );
|
|
||||||
}
|
}
|
||||||
for ( String index : state.getIndexes() ) {
|
TupleRelationalState tupleRelationalState = TupleRelationalState.class.cast( state );
|
||||||
table.getOrCreateIndex( index ).addColumn( columnValue );
|
return tupleRelationalState.getRelationalStates().size() == 1 ?
|
||||||
}
|
tupleRelationalState.getRelationalStates().get( 0 ) :
|
||||||
return columnValue;
|
state;
|
||||||
}
|
|
||||||
|
|
||||||
// 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 <T extends DerivedRelationalState> 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -111,37 +111,4 @@ public interface AttributeBinding {
|
||||||
public Set<EntityReferencingAttributeBinding> getEntityReferencingAttributeBindings();
|
public Set<EntityReferencingAttributeBinding> getEntityReferencingAttributeBindings();
|
||||||
|
|
||||||
public void validate();
|
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<String> getUniqueKeys();
|
|
||||||
Set<String> getIndexes();
|
|
||||||
}
|
|
||||||
|
|
||||||
interface DerivedRelationalState extends SingleValueRelationalState {
|
|
||||||
String getFormula();
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SimpleTupleRelationalState extends AbstractAttributeBinding.TupleRelationalState<SingleValueRelationalState> {
|
|
||||||
}
|
|
||||||
|
|
||||||
interface TupleRelationalState<T extends RelationalState> extends RelationalState{
|
|
||||||
List<T> getRelationalStates();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
package org.hibernate.metamodel.binding;
|
package org.hibernate.metamodel.binding;
|
||||||
|
|
||||||
import org.hibernate.metamodel.relational.Value;
|
import org.hibernate.metamodel.relational.Value;
|
||||||
|
import org.hibernate.metamodel.state.domain.CollectionElementDomainState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO : javadoc
|
* TODO : javadoc
|
||||||
|
@ -31,10 +32,6 @@ import org.hibernate.metamodel.relational.Value;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class CollectionElement {
|
public class CollectionElement {
|
||||||
public static interface DomainState {
|
|
||||||
HibernateTypeDescriptor getHibernateTypeDescriptor();
|
|
||||||
String getNodeName();
|
|
||||||
}
|
|
||||||
|
|
||||||
private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
||||||
private final PluralAttributeBinding collectionBinding;
|
private final PluralAttributeBinding collectionBinding;
|
||||||
|
@ -47,7 +44,7 @@ public class CollectionElement {
|
||||||
this.collectionBinding = collectionBinding;
|
this.collectionBinding = collectionBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize(DomainState state) {
|
public void initialize(CollectionElementDomainState state) {
|
||||||
hibernateTypeDescriptor.initialize( state.getHibernateTypeDescriptor() );
|
hibernateTypeDescriptor.initialize( state.getHibernateTypeDescriptor() );
|
||||||
nodeName = state.getNodeName();
|
nodeName = state.getNodeName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@ import org.hibernate.internal.util.ReflectHelper;
|
||||||
import org.hibernate.metamodel.relational.ForeignKey;
|
import org.hibernate.metamodel.relational.ForeignKey;
|
||||||
import org.hibernate.metamodel.relational.SimpleValue;
|
import org.hibernate.metamodel.relational.SimpleValue;
|
||||||
import org.hibernate.metamodel.relational.Column;
|
import org.hibernate.metamodel.relational.Column;
|
||||||
|
import org.hibernate.metamodel.state.domain.ManyToOneAttributeDomainState;
|
||||||
|
import org.hibernate.metamodel.state.relational.ManyToOneRelationalState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO : javadoc
|
* TODO : javadoc
|
||||||
|
@ -45,23 +47,11 @@ public class ManyToOneAttributeBinding extends SingularAttributeBinding implemen
|
||||||
private AttributeBinding referencedAttributeBinding;
|
private AttributeBinding referencedAttributeBinding;
|
||||||
private boolean ignoreNotFound;
|
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) {
|
ManyToOneAttributeBinding(EntityBinding entityBinding) {
|
||||||
super( entityBinding, false, false );
|
super( entityBinding, false, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void initialize(DomainState state) {
|
public final void initialize(ManyToOneAttributeDomainState state) {
|
||||||
super.initialize( state );
|
super.initialize( state );
|
||||||
isPropertyReference = state.getReferencedAttributeName() != null;
|
isPropertyReference = state.getReferencedAttributeName() != null;
|
||||||
referencedAttributeName = state.getReferencedAttributeName();
|
referencedAttributeName = state.getReferencedAttributeName();
|
||||||
|
@ -75,8 +65,8 @@ public class ManyToOneAttributeBinding extends SingularAttributeBinding implemen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void initialize(RelationalState state) {
|
public final void initialize(ManyToOneRelationalState state) {
|
||||||
super.initialize( state );
|
super.initializeValue( state );
|
||||||
isLogicalOneToOne = state.isLogicalOneToOne();
|
isLogicalOneToOne = state.isLogicalOneToOne();
|
||||||
foreignKeyName = state.getForeignKeyName();
|
foreignKeyName = state.getForeignKeyName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,19 +26,13 @@ package org.hibernate.metamodel.binding;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
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.jboss.logging.Logger;
|
||||||
|
|
||||||
import org.hibernate.FetchMode;
|
import org.hibernate.FetchMode;
|
||||||
import org.hibernate.MappingException;
|
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
import org.hibernate.metamodel.relational.Table;
|
import org.hibernate.metamodel.relational.Table;
|
||||||
import org.hibernate.metamodel.source.hbm.HbmHelper;
|
import org.hibernate.metamodel.state.domain.PluralAttributeDomainState;
|
||||||
import org.hibernate.metamodel.source.util.DomHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO : javadoc
|
* TODO : javadoc
|
||||||
|
@ -47,35 +41,6 @@ import org.hibernate.metamodel.source.util.DomHelper;
|
||||||
*/
|
*/
|
||||||
public abstract class PluralAttributeBinding extends AbstractAttributeBinding {
|
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(
|
private static final CoreMessageLogger LOG = Logger.getMessageLogger(
|
||||||
CoreMessageLogger.class, PluralAttributeBinding.class.getName()
|
CoreMessageLogger.class, PluralAttributeBinding.class.getName()
|
||||||
);
|
);
|
||||||
|
@ -119,11 +84,12 @@ public abstract class PluralAttributeBinding extends AbstractAttributeBinding {
|
||||||
collectionElement = new CollectionElement( this );
|
collectionElement = new CollectionElement( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize(DomainState state) {
|
public void initialize(PluralAttributeDomainState state) {
|
||||||
super.initialize( state );
|
super.initialize( state );
|
||||||
fetchMode = state.getFetchMode();
|
fetchMode = state.getFetchMode();
|
||||||
extraLazy = state.isExtraLazy();
|
extraLazy = state.isExtraLazy();
|
||||||
collectionElement = state.getCollectionElement( this );
|
collectionElement = new ElementCollectionElement( this );
|
||||||
|
collectionElement.initialize( state.getCollectionElementDomainState() );
|
||||||
inverse = state.isInverse();
|
inverse = state.isInverse();
|
||||||
mutable = state.isMutable();
|
mutable = state.isMutable();
|
||||||
subselectLoadable = state.isSubselectLoadable();
|
subselectLoadable = state.isSubselectLoadable();
|
||||||
|
@ -152,8 +118,6 @@ public abstract class PluralAttributeBinding extends AbstractAttributeBinding {
|
||||||
loaderName = state.getLoaderName();
|
loaderName = state.getLoaderName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected boolean isLazyDefault(MappingDefaults defaults) {
|
protected boolean isLazyDefault(MappingDefaults defaults) {
|
||||||
return defaults.isDefaultLazy();
|
return defaults.isDefaultLazy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,10 @@
|
||||||
package org.hibernate.metamodel.binding;
|
package org.hibernate.metamodel.binding;
|
||||||
|
|
||||||
import org.hibernate.mapping.PropertyGeneration;
|
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
|
* TODO : javadoc
|
||||||
|
@ -31,31 +35,27 @@ import org.hibernate.mapping.PropertyGeneration;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class SimpleAttributeBinding extends SingularAttributeBinding {
|
public class SimpleAttributeBinding extends SingularAttributeBinding {
|
||||||
public static interface DomainState extends SingularAttributeBinding.DomainState {
|
|
||||||
public PropertyGeneration getPropertyGeneration();
|
|
||||||
}
|
|
||||||
|
|
||||||
private PropertyGeneration generation;
|
private PropertyGeneration generation;
|
||||||
|
|
||||||
SimpleAttributeBinding(EntityBinding entityBinding, boolean forceNonNullable, boolean forceUnique) {
|
SimpleAttributeBinding(EntityBinding entityBinding, boolean forceNonNullable, boolean forceUnique) {
|
||||||
super( entityBinding, forceNonNullable, forceUnique );
|
super( entityBinding, forceNonNullable, forceUnique );
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void initialize(DomainState state) {
|
public final void initialize(SimpleAttributeDomainState state) {
|
||||||
super.initialize( state );
|
super.initialize( state );
|
||||||
generation = state.getPropertyGeneration();
|
generation = state.getPropertyGeneration();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initializeColumnValue(ColumnRelationalState state) {
|
public void initializeColumnValue(ColumnRelationalState state) {
|
||||||
super.initializeColumnValue( state );
|
super.initializeValue( state );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initializeDerivedValue(DerivedRelationalState state) {
|
public void initializeDerivedValue(DerivedValueRelationalState state) {
|
||||||
super.initializeDerivedValue( state );
|
super.initializeValue( state );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initializeSimpleTupleValue(SimpleTupleRelationalState state) {
|
public void initializeTupleValue(TupleRelationalState state) {
|
||||||
super.initializeSimpleTupleValue( state );
|
super.initializeValue( state );
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isUnique(ColumnRelationalState state) {
|
private boolean isUnique(ColumnRelationalState state) {
|
||||||
|
|
|
@ -23,19 +23,14 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.metamodel.binding;
|
package org.hibernate.metamodel.binding;
|
||||||
|
|
||||||
|
import org.hibernate.metamodel.state.domain.SingularAttributeDomainState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO : javadoc
|
* TODO : javadoc
|
||||||
*
|
*
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
public abstract class SingularAttributeBinding extends AbstractAttributeBinding implements KeyValueBinding {
|
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 forceNonNullable;
|
||||||
private final boolean forceUnique;
|
private final boolean forceUnique;
|
||||||
private boolean insertable;
|
private boolean insertable;
|
||||||
|
@ -49,7 +44,7 @@ public abstract class SingularAttributeBinding extends AbstractAttributeBinding
|
||||||
this.forceUnique = forceUnique;
|
this.forceUnique = forceUnique;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void initialize(DomainState state) {
|
public final void initialize(SingularAttributeDomainState state) {
|
||||||
super.initialize( state );
|
super.initialize( state );
|
||||||
insertable = state.isInsertable();
|
insertable = state.isInsertable();
|
||||||
updateable = state.isUpdateable();
|
updateable = state.isUpdateable();
|
||||||
|
|
|
@ -26,7 +26,7 @@ package org.hibernate.metamodel.relational;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.cfg.NamingStrategy;
|
import org.hibernate.cfg.NamingStrategy;
|
||||||
import org.hibernate.metamodel.binding.SimpleAttributeBinding;
|
import org.hibernate.metamodel.state.relational.ColumnRelationalState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Models a physical column
|
* Models a physical column
|
||||||
|
@ -55,6 +55,26 @@ public class Column extends AbstractSimpleValue implements SimpleValue {
|
||||||
this.name = name;
|
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() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
@ -135,5 +155,4 @@ public class Column extends AbstractSimpleValue implements SimpleValue {
|
||||||
public String toLoggableString() {
|
public String toLoggableString() {
|
||||||
return getTable().getLoggableValueQualifier() + '.' + getName();
|
return getTable().getLoggableValueQualifier() + '.' + getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,4 +75,5 @@ public interface Value {
|
||||||
* @throws org.hibernate.metamodel.ValidationException if validaton fails.
|
* @throws org.hibernate.metamodel.ValidationException if validaton fails.
|
||||||
*/
|
*/
|
||||||
public void validateJdbcTypes(JdbcCodes typeCodes);
|
public void validateJdbcTypes(JdbcCodes typeCodes);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -213,7 +213,7 @@ public class EntityBinder {
|
||||||
AttributeColumnRelationalState columnRelationsState = new AttributeColumnRelationalState( idAttribute, meta );
|
AttributeColumnRelationalState columnRelationsState = new AttributeColumnRelationalState( idAttribute, meta );
|
||||||
AttributeTupleRelationalState relationalState = new AttributeTupleRelationalState();
|
AttributeTupleRelationalState relationalState = new AttributeTupleRelationalState();
|
||||||
relationalState.addValueState( columnRelationsState );
|
relationalState.addValueState( columnRelationsState );
|
||||||
idBinding.initializeSimpleTupleValue( relationalState );
|
idBinding.initializeTupleValue( relationalState );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindAttributes(EntityBinding entityBinding) {
|
private void bindAttributes(EntityBinding entityBinding) {
|
||||||
|
@ -241,7 +241,7 @@ public class EntityBinder {
|
||||||
);
|
);
|
||||||
AttributeTupleRelationalState relationalState = new AttributeTupleRelationalState();
|
AttributeTupleRelationalState relationalState = new AttributeTupleRelationalState();
|
||||||
relationalState.addValueState( columnRelationsState );
|
relationalState.addValueState( columnRelationsState );
|
||||||
attributeBinding.initializeSimpleTupleValue( relationalState );
|
attributeBinding.initializeTupleValue( relationalState );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,16 +5,16 @@ import java.util.Map;
|
||||||
import org.hibernate.mapping.PropertyGeneration;
|
import org.hibernate.mapping.PropertyGeneration;
|
||||||
import org.hibernate.metamodel.binding.EntityBinding;
|
import org.hibernate.metamodel.binding.EntityBinding;
|
||||||
import org.hibernate.metamodel.binding.HibernateTypeDescriptor;
|
import org.hibernate.metamodel.binding.HibernateTypeDescriptor;
|
||||||
import org.hibernate.metamodel.binding.SimpleAttributeBinding;
|
|
||||||
import org.hibernate.metamodel.domain.Attribute;
|
import org.hibernate.metamodel.domain.Attribute;
|
||||||
import org.hibernate.metamodel.domain.Entity;
|
import org.hibernate.metamodel.domain.Entity;
|
||||||
import org.hibernate.metamodel.domain.MetaAttribute;
|
import org.hibernate.metamodel.domain.MetaAttribute;
|
||||||
|
import org.hibernate.metamodel.state.domain.SimpleAttributeDomainState;
|
||||||
import org.hibernate.metamodel.source.annotations.MappedAttribute;
|
import org.hibernate.metamodel.source.annotations.MappedAttribute;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
*/
|
*/
|
||||||
public class AttributeDomainState implements SimpleAttributeBinding.DomainState {
|
public class AttributeDomainState implements SimpleAttributeDomainState {
|
||||||
private final PropertyGeneration propertyGeneration = null;
|
private final PropertyGeneration propertyGeneration = null;
|
||||||
private final HibernateTypeDescriptor typeDescriptor;
|
private final HibernateTypeDescriptor typeDescriptor;
|
||||||
private final Attribute attribute;
|
private final Attribute attribute;
|
||||||
|
@ -101,7 +101,7 @@ public class AttributeDomainState implements SimpleAttributeBinding.DomainState
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, MetaAttribute> getMetaAttributes(EntityBinding entityBinding) {
|
public Map<String, MetaAttribute> getMetaAttributes() {
|
||||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,17 +33,18 @@ import org.jboss.jandex.AnnotationInstance;
|
||||||
|
|
||||||
import org.hibernate.AnnotationException;
|
import org.hibernate.AnnotationException;
|
||||||
import org.hibernate.cfg.NamingStrategy;
|
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.relational.Size;
|
||||||
import org.hibernate.metamodel.source.annotations.ColumnValues;
|
import org.hibernate.metamodel.source.annotations.ColumnValues;
|
||||||
import org.hibernate.metamodel.source.annotations.HibernateDotNames;
|
import org.hibernate.metamodel.source.annotations.HibernateDotNames;
|
||||||
import org.hibernate.metamodel.source.annotations.MappedAttribute;
|
import org.hibernate.metamodel.source.annotations.MappedAttribute;
|
||||||
import org.hibernate.metamodel.source.internal.MetadataImpl;
|
import org.hibernate.metamodel.source.internal.MetadataImpl;
|
||||||
|
import org.hibernate.metamodel.state.relational.ColumnRelationalState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
*/
|
*/
|
||||||
public class AttributeColumnRelationalState implements SimpleAttributeBinding.ColumnRelationalState {
|
public class AttributeColumnRelationalState implements ColumnRelationalState {
|
||||||
private final NamingStrategy namingStrategy;
|
private final NamingStrategy namingStrategy;
|
||||||
private final String columnName;
|
private final String columnName;
|
||||||
private final boolean unique;
|
private final boolean unique;
|
||||||
|
|
|
@ -26,21 +26,21 @@ package org.hibernate.metamodel.source.annotations.state.relational;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.metamodel.binding.AttributeBinding;
|
import org.hibernate.metamodel.state.relational.SimpleValueRelationalState;
|
||||||
import org.hibernate.metamodel.binding.SimpleAttributeBinding;
|
import org.hibernate.metamodel.state.relational.TupleRelationalState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
*/
|
*/
|
||||||
public class AttributeTupleRelationalState implements SimpleAttributeBinding.SimpleTupleRelationalState {
|
public class AttributeTupleRelationalState implements TupleRelationalState {
|
||||||
List<AttributeBinding.SingleValueRelationalState> valueStates = new ArrayList<AttributeBinding.SingleValueRelationalState>();
|
List<SimpleValueRelationalState> valueStates = new ArrayList<SimpleValueRelationalState>();
|
||||||
|
|
||||||
public void addValueState(AttributeBinding.SingleValueRelationalState state) {
|
public void addValueState(SimpleValueRelationalState state) {
|
||||||
valueStates.add( state );
|
valueStates.add( state );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AttributeBinding.SingleValueRelationalState> getRelationalStates() {
|
public List<SimpleValueRelationalState> getRelationalStates() {
|
||||||
return valueStates;
|
return valueStates;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -435,7 +435,7 @@ PrimitiveArray
|
||||||
if ( attributeBinding.getValue() == null ) {
|
if ( attributeBinding.getValue() == null ) {
|
||||||
// relational model has not been bound yet
|
// relational model has not been bound yet
|
||||||
// boolean (true here) indicates that by default column names should be guessed
|
// boolean (true here) indicates that by default column names should be guessed
|
||||||
attributeBinding.initializeSimpleTupleValue(
|
attributeBinding.initializeTupleValue(
|
||||||
new HbmSimpleValueRelationalStateContainer(
|
new HbmSimpleValueRelationalStateContainer(
|
||||||
getHibernateMappingBinder(),
|
getHibernateMappingBinder(),
|
||||||
true,
|
true,
|
||||||
|
@ -463,7 +463,7 @@ PrimitiveArray
|
||||||
if ( attributeBinding.getValue() == null ) {
|
if ( attributeBinding.getValue() == null ) {
|
||||||
// relational model has not been bound yet
|
// relational model has not been bound yet
|
||||||
// boolean (true here) indicates that by default column names should be guessed
|
// boolean (true here) indicates that by default column names should be guessed
|
||||||
attributeBinding.initializeSimpleTupleValue(
|
attributeBinding.initializeTupleValue(
|
||||||
new HbmSimpleValueRelationalStateContainer(
|
new HbmSimpleValueRelationalStateContainer(
|
||||||
getHibernateMappingBinder(),
|
getHibernateMappingBinder(),
|
||||||
true,
|
true,
|
||||||
|
@ -491,7 +491,7 @@ PrimitiveArray
|
||||||
if ( attributeBinding.getValue() == null ) {
|
if ( attributeBinding.getValue() == null ) {
|
||||||
// relational model has not been bound yet
|
// relational model has not been bound yet
|
||||||
// boolean (true here) indicates that by default column names should be guessed
|
// boolean (true here) indicates that by default column names should be guessed
|
||||||
attributeBinding.initializeSimpleTupleValue(
|
attributeBinding.initializeTupleValue(
|
||||||
new HbmSimpleValueRelationalStateContainer(
|
new HbmSimpleValueRelationalStateContainer(
|
||||||
getHibernateMappingBinder(),
|
getHibernateMappingBinder(),
|
||||||
true,
|
true,
|
||||||
|
@ -519,7 +519,7 @@ PrimitiveArray
|
||||||
if ( attributeBinding.getValue() == null ) {
|
if ( attributeBinding.getValue() == null ) {
|
||||||
// relational model has not been bound yet
|
// relational model has not been bound yet
|
||||||
// boolean (true here) indicates that by default column names should be guessed
|
// boolean (true here) indicates that by default column names should be guessed
|
||||||
attributeBinding.initializeSimpleTupleValue(
|
attributeBinding.initializeTupleValue(
|
||||||
new HbmSimpleValueRelationalStateContainer(
|
new HbmSimpleValueRelationalStateContainer(
|
||||||
getHibernateMappingBinder(),
|
getHibernateMappingBinder(),
|
||||||
true,
|
true,
|
||||||
|
@ -546,7 +546,7 @@ PrimitiveArray
|
||||||
if ( attributeBinding.getValue() == null ) {
|
if ( attributeBinding.getValue() == null ) {
|
||||||
// relational model has not been bound yet
|
// relational model has not been bound yet
|
||||||
// boolean (true here) indicates that by default column names should be guessed
|
// boolean (true here) indicates that by default column names should be guessed
|
||||||
attributeBinding.initializeSimpleTupleValue(
|
attributeBinding.initializeTupleValue(
|
||||||
new HbmSimpleValueRelationalStateContainer(
|
new HbmSimpleValueRelationalStateContainer(
|
||||||
getHibernateMappingBinder(),
|
getHibernateMappingBinder(),
|
||||||
true,
|
true,
|
||||||
|
|
|
@ -25,17 +25,16 @@ package org.hibernate.metamodel.source.hbm.state.domain;
|
||||||
|
|
||||||
import java.util.Map;
|
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.binding.MappingDefaults;
|
||||||
import org.hibernate.metamodel.domain.Attribute;
|
import org.hibernate.metamodel.domain.Attribute;
|
||||||
import org.hibernate.metamodel.domain.MetaAttribute;
|
import org.hibernate.metamodel.domain.MetaAttribute;
|
||||||
import org.hibernate.metamodel.source.util.MappingHelper;
|
import org.hibernate.metamodel.source.util.MappingHelper;
|
||||||
|
import org.hibernate.metamodel.state.domain.AttributeDomainState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractHbmAttributeDomainState implements AbstractAttributeBinding.DomainState {
|
public abstract class AbstractHbmAttributeDomainState implements AttributeDomainState {
|
||||||
private final MappingDefaults defaults;
|
private final MappingDefaults defaults;
|
||||||
private final Attribute attribute;
|
private final Attribute attribute;
|
||||||
private final String nodeName;
|
private final String nodeName;
|
||||||
|
@ -78,7 +77,7 @@ public abstract class AbstractHbmAttributeDomainState implements AbstractAttribu
|
||||||
return nodeName;
|
return nodeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Map<String, MetaAttribute> getMetaAttributes(EntityBinding entityBinding) {
|
public final Map<String, MetaAttribute> getMetaAttributes() {
|
||||||
return metaAttributes;
|
return metaAttributes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,12 @@ package org.hibernate.metamodel.source.hbm.state.domain;
|
||||||
import org.hibernate.metamodel.binding.CollectionElement;
|
import org.hibernate.metamodel.binding.CollectionElement;
|
||||||
import org.hibernate.metamodel.binding.HibernateTypeDescriptor;
|
import org.hibernate.metamodel.binding.HibernateTypeDescriptor;
|
||||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLElementElement;
|
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLElementElement;
|
||||||
|
import org.hibernate.metamodel.state.domain.CollectionElementDomainState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
public class HbmCollectionElementDomainState implements CollectionElement.DomainState {
|
public class HbmCollectionElementDomainState implements CollectionElementDomainState {
|
||||||
private final XMLElementElement element;
|
private final XMLElementElement element;
|
||||||
|
|
||||||
HbmCollectionElementDomainState(XMLElementElement element) {
|
HbmCollectionElementDomainState(XMLElementElement element) {
|
||||||
|
|
|
@ -33,13 +33,14 @@ import org.hibernate.metamodel.domain.MetaAttribute;
|
||||||
import org.hibernate.metamodel.source.hbm.HbmHelper;
|
import org.hibernate.metamodel.source.hbm.HbmHelper;
|
||||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLManyToOneElement;
|
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLManyToOneElement;
|
||||||
import org.hibernate.metamodel.source.util.MappingHelper;
|
import org.hibernate.metamodel.source.util.MappingHelper;
|
||||||
|
import org.hibernate.metamodel.state.domain.ManyToOneAttributeDomainState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
public class HbmManyToOneAttributeDomainState
|
public class HbmManyToOneAttributeDomainState
|
||||||
extends AbstractHbmAttributeDomainState
|
extends AbstractHbmAttributeDomainState
|
||||||
implements ManyToOneAttributeBinding.DomainState {
|
implements ManyToOneAttributeDomainState {
|
||||||
|
|
||||||
private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
||||||
private final FetchMode fetchMode;
|
private final FetchMode fetchMode;
|
||||||
|
|
|
@ -30,12 +30,10 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.FetchMode;
|
import org.hibernate.FetchMode;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.metamodel.binding.CollectionElement;
|
|
||||||
import org.hibernate.metamodel.binding.CustomSQL;
|
import org.hibernate.metamodel.binding.CustomSQL;
|
||||||
import org.hibernate.metamodel.binding.ElementCollectionElement;
|
import org.hibernate.metamodel.binding.ElementCollectionElement;
|
||||||
import org.hibernate.metamodel.binding.HibernateTypeDescriptor;
|
import org.hibernate.metamodel.binding.HibernateTypeDescriptor;
|
||||||
import org.hibernate.metamodel.binding.MappingDefaults;
|
import org.hibernate.metamodel.binding.MappingDefaults;
|
||||||
import org.hibernate.metamodel.binding.PluralAttributeBinding;
|
|
||||||
import org.hibernate.metamodel.domain.Attribute;
|
import org.hibernate.metamodel.domain.Attribute;
|
||||||
import org.hibernate.metamodel.domain.MetaAttribute;
|
import org.hibernate.metamodel.domain.MetaAttribute;
|
||||||
import org.hibernate.metamodel.source.hbm.HbmHelper;
|
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.hbm.xml.mapping.XMLSynchronizeElement;
|
||||||
|
|
||||||
import org.hibernate.metamodel.source.util.MappingHelper;
|
import org.hibernate.metamodel.source.util.MappingHelper;
|
||||||
|
import org.hibernate.metamodel.state.domain.CollectionElementDomainState;
|
||||||
|
import org.hibernate.metamodel.state.domain.PluralAttributeDomainState;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
public class HbmPluralAttributeDomainState extends AbstractHbmAttributeDomainState implements PluralAttributeBinding.DomainState {
|
public class HbmPluralAttributeDomainState extends AbstractHbmAttributeDomainState implements PluralAttributeDomainState {
|
||||||
private final XMLBagElement collection;
|
private final XMLBagElement collection;
|
||||||
private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
||||||
private final String cascade;
|
private final String cascade;
|
||||||
|
@ -121,10 +121,8 @@ public class HbmPluralAttributeDomainState extends AbstractHbmAttributeDomainSta
|
||||||
return ( "extra".equals( collection.getLazy() ) );
|
return ( "extra".equals( collection.getLazy() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public CollectionElement getCollectionElement(PluralAttributeBinding binding) {
|
public CollectionElementDomainState getCollectionElementDomainState() {
|
||||||
ElementCollectionElement collectionElement = new ElementCollectionElement( binding );
|
return new HbmCollectionElementDomainState( collection.getElement() );
|
||||||
collectionElement.initialize( new HbmCollectionElementDomainState( collection.getElement() ) );
|
|
||||||
return collectionElement;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInverse() {
|
public boolean isInverse() {
|
||||||
|
|
|
@ -29,7 +29,6 @@ import org.hibernate.MappingException;
|
||||||
import org.hibernate.mapping.PropertyGeneration;
|
import org.hibernate.mapping.PropertyGeneration;
|
||||||
import org.hibernate.metamodel.binding.HibernateTypeDescriptor;
|
import org.hibernate.metamodel.binding.HibernateTypeDescriptor;
|
||||||
import org.hibernate.metamodel.binding.MappingDefaults;
|
import org.hibernate.metamodel.binding.MappingDefaults;
|
||||||
import org.hibernate.metamodel.binding.SimpleAttributeBinding;
|
|
||||||
import org.hibernate.metamodel.domain.MetaAttribute;
|
import org.hibernate.metamodel.domain.MetaAttribute;
|
||||||
import org.hibernate.metamodel.source.hbm.HbmHelper;
|
import org.hibernate.metamodel.source.hbm.HbmHelper;
|
||||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLDiscriminator;
|
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.XMLHibernateMapping.XMLClass.XMLVersion;
|
||||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertyElement;
|
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertyElement;
|
||||||
import org.hibernate.metamodel.source.util.MappingHelper;
|
import org.hibernate.metamodel.source.util.MappingHelper;
|
||||||
|
import org.hibernate.metamodel.state.domain.SimpleAttributeDomainState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gail Badner
|
* @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 HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
||||||
private final boolean isLazy;
|
private final boolean isLazy;
|
||||||
private final PropertyGeneration propertyGeneration;
|
private final PropertyGeneration propertyGeneration;
|
||||||
|
|
|
@ -27,7 +27,6 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.cfg.NamingStrategy;
|
import org.hibernate.cfg.NamingStrategy;
|
||||||
import org.hibernate.metamodel.binding.AbstractAttributeBinding;
|
|
||||||
import org.hibernate.metamodel.relational.Size;
|
import org.hibernate.metamodel.relational.Size;
|
||||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLColumnElement;
|
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.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.XMLManyToOneElement;
|
||||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertyElement;
|
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertyElement;
|
||||||
import org.hibernate.metamodel.source.util.MappingHelper;
|
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.
|
// TODO: remove duplication after Id, Discriminator, Version, Timestamp, and Property extend a common interface.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
public class HbmColumnRelationalState implements AbstractAttributeBinding.ColumnRelationalState {
|
public class HbmColumnRelationalState implements ColumnRelationalState {
|
||||||
private final HbmSimpleValueRelationalStateContainer container;
|
private final HbmSimpleValueRelationalStateContainer container;
|
||||||
private final String explicitColumnName;
|
private final String explicitColumnName;
|
||||||
private final Size size;
|
private final Size size;
|
||||||
|
|
|
@ -23,12 +23,12 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.metamodel.source.hbm.state.relational;
|
package org.hibernate.metamodel.source.hbm.state.relational;
|
||||||
|
|
||||||
import org.hibernate.metamodel.binding.SimpleAttributeBinding;
|
import org.hibernate.metamodel.state.relational.DerivedValueRelationalState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
public class HbmDerivedValueRelationalState implements SimpleAttributeBinding.DerivedRelationalState {
|
public class HbmDerivedValueRelationalState implements DerivedValueRelationalState {
|
||||||
private final String formula;
|
private final String formula;
|
||||||
|
|
||||||
public HbmDerivedValueRelationalState(String formula) {
|
public HbmDerivedValueRelationalState(String formula) {
|
||||||
|
|
|
@ -23,15 +23,15 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.metamodel.source.hbm.state.relational;
|
package org.hibernate.metamodel.source.hbm.state.relational;
|
||||||
|
|
||||||
import org.hibernate.metamodel.binding.ManyToOneAttributeBinding;
|
|
||||||
import org.hibernate.metamodel.binding.MappingDefaults;
|
import org.hibernate.metamodel.binding.MappingDefaults;
|
||||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLManyToOneElement;
|
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLManyToOneElement;
|
||||||
|
import org.hibernate.metamodel.state.relational.ManyToOneRelationalState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
public class HbmManyToOneRelationalStateContainer extends HbmSimpleValueRelationalStateContainer
|
public class HbmManyToOneRelationalStateContainer extends HbmSimpleValueRelationalStateContainer
|
||||||
implements ManyToOneAttributeBinding.RelationalState {
|
implements ManyToOneRelationalState {
|
||||||
|
|
||||||
private final boolean isLogicalOneToOne;
|
private final boolean isLogicalOneToOne;
|
||||||
private final String foreignKeyName;
|
private final String foreignKeyName;
|
||||||
|
|
|
@ -25,17 +25,13 @@ package org.hibernate.metamodel.source.hbm.state.relational;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.cfg.NamingStrategy;
|
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.HibernateTypeDescriptor;
|
||||||
import org.hibernate.metamodel.binding.MappingDefaults;
|
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.XMLColumnElement;
|
||||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLDiscriminator;
|
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLDiscriminator;
|
||||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLId;
|
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.XMLHibernateMapping.XMLClass.XMLVersion;
|
||||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLManyToOneElement;
|
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLManyToOneElement;
|
||||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertyElement;
|
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
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
public class HbmSimpleValueRelationalStateContainer implements AbstractAttributeBinding.SimpleTupleRelationalState {
|
public class HbmSimpleValueRelationalStateContainer implements TupleRelationalState {
|
||||||
private final MappingDefaults defaults;
|
private final MappingDefaults defaults;
|
||||||
private final Set<String> propertyUniqueKeys;
|
private final Set<String> propertyUniqueKeys;
|
||||||
private final Set<String> propertyIndexes;
|
private final Set<String> propertyIndexes;
|
||||||
private final List<AttributeBinding.SingleValueRelationalState> singleValueStates;
|
private final List<SimpleValueRelationalState> simpleValueStates;
|
||||||
private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
||||||
|
|
||||||
public NamingStrategy getNamingStrategy() {
|
public NamingStrategy getNamingStrategy() {
|
||||||
|
@ -64,11 +62,11 @@ public class HbmSimpleValueRelationalStateContainer implements AbstractAttribute
|
||||||
boolean autoColumnCreation,
|
boolean autoColumnCreation,
|
||||||
XMLId id) {
|
XMLId id) {
|
||||||
this( defaults, id.getColumn() );
|
this( defaults, id.getColumn() );
|
||||||
if ( singleValueStates.isEmpty() ) {
|
if ( simpleValueStates.isEmpty() ) {
|
||||||
if ( id.getColumn() == null && ! autoColumnCreation ) {
|
if ( id.getColumn() == null && ! autoColumnCreation ) {
|
||||||
throw new MappingException( "No columns to map and auto column creation is disabled." );
|
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 ) {
|
else if ( id.getColumn() != null ) {
|
||||||
throw new MappingException( "column attribute may not be used together with <column> subelement" );
|
throw new MappingException( "column attribute may not be used together with <column> subelement" );
|
||||||
|
@ -80,11 +78,11 @@ public class HbmSimpleValueRelationalStateContainer implements AbstractAttribute
|
||||||
boolean autoColumnCreation,
|
boolean autoColumnCreation,
|
||||||
XMLDiscriminator discriminator) {
|
XMLDiscriminator discriminator) {
|
||||||
this( defaults, discriminator.getFormula(), discriminator.getColumn() );
|
this( defaults, discriminator.getFormula(), discriminator.getColumn() );
|
||||||
if ( singleValueStates.isEmpty() ) {
|
if ( simpleValueStates.isEmpty() ) {
|
||||||
if ( discriminator.getColumn() == null && discriminator.getFormula() == null && ! autoColumnCreation ) {
|
if ( discriminator.getColumn() == null && discriminator.getFormula() == null && ! autoColumnCreation ) {
|
||||||
throw new MappingException( "No column or formula to map and auto column creation is disabled." );
|
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) {
|
else if ( discriminator.getColumn() != null || discriminator.getFormula() != null) {
|
||||||
throw new MappingException( "column/formula attribute may not be used together with <column>/<formula> subelement" );
|
throw new MappingException( "column/formula attribute may not be used together with <column>/<formula> subelement" );
|
||||||
|
@ -96,11 +94,11 @@ public class HbmSimpleValueRelationalStateContainer implements AbstractAttribute
|
||||||
boolean autoColumnCreation,
|
boolean autoColumnCreation,
|
||||||
XMLVersion version) {
|
XMLVersion version) {
|
||||||
this( defaults, version.getColumn() );
|
this( defaults, version.getColumn() );
|
||||||
if ( singleValueStates.isEmpty() ) {
|
if ( simpleValueStates.isEmpty() ) {
|
||||||
if ( version.getColumn() == null && ! autoColumnCreation ) {
|
if ( version.getColumn() == null && ! autoColumnCreation ) {
|
||||||
throw new MappingException( "No column or formula to map and auto column creation is disabled." );
|
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 ) {
|
else if ( version.getColumn() != null ) {
|
||||||
throw new MappingException( "column attribute may not be used together with <column> subelement" );
|
throw new MappingException( "column attribute may not be used together with <column> subelement" );
|
||||||
|
@ -112,11 +110,11 @@ public class HbmSimpleValueRelationalStateContainer implements AbstractAttribute
|
||||||
boolean autoColumnCreation,
|
boolean autoColumnCreation,
|
||||||
XMLTimestamp timestamp) {
|
XMLTimestamp timestamp) {
|
||||||
this( defaults, null );
|
this( defaults, null );
|
||||||
if ( singleValueStates.isEmpty() ) {
|
if ( simpleValueStates.isEmpty() ) {
|
||||||
if ( timestamp.getColumn() == null && ! autoColumnCreation ) {
|
if ( timestamp.getColumn() == null && ! autoColumnCreation ) {
|
||||||
throw new MappingException( "No columns to map and auto column creation is disabled." );
|
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 ) {
|
else if ( timestamp.getColumn() != null ) {
|
||||||
throw new MappingException( "column attribute may not be used together with <column> subelement" );
|
throw new MappingException( "column attribute may not be used together with <column> subelement" );
|
||||||
|
@ -128,11 +126,11 @@ public class HbmSimpleValueRelationalStateContainer implements AbstractAttribute
|
||||||
boolean autoColumnCreation,
|
boolean autoColumnCreation,
|
||||||
XMLPropertyElement property) {
|
XMLPropertyElement property) {
|
||||||
this( defaults, property.getColumnOrFormula() );
|
this( defaults, property.getColumnOrFormula() );
|
||||||
if ( singleValueStates.isEmpty() ) {
|
if ( simpleValueStates.isEmpty() ) {
|
||||||
if ( property.getColumn() == null && property.getFormula() == null && ! autoColumnCreation ) {
|
if ( property.getColumn() == null && property.getFormula() == null && ! autoColumnCreation ) {
|
||||||
throw new MappingException( "No column or formula to map and auto column creation is disabled." );
|
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) {
|
else if ( property.getColumn() != null || property.getFormula() != null) {
|
||||||
throw new MappingException( "column/formula attribute may not be used together with <column>/<formula> subelement" );
|
throw new MappingException( "column/formula attribute may not be used together with <column>/<formula> subelement" );
|
||||||
|
@ -144,11 +142,11 @@ public class HbmSimpleValueRelationalStateContainer implements AbstractAttribute
|
||||||
boolean autoColumnCreation,
|
boolean autoColumnCreation,
|
||||||
XMLManyToOneElement manyToOne) {
|
XMLManyToOneElement manyToOne) {
|
||||||
this( defaults, manyToOne.getColumnOrFormula() );
|
this( defaults, manyToOne.getColumnOrFormula() );
|
||||||
if ( singleValueStates.isEmpty() ) {
|
if ( simpleValueStates.isEmpty() ) {
|
||||||
if ( manyToOne.getColumn() == null && manyToOne.getFormula() == null && ! autoColumnCreation ) {
|
if ( manyToOne.getColumn() == null && manyToOne.getFormula() == null && ! autoColumnCreation ) {
|
||||||
throw new MappingException( "No column or formula to map and auto column creation is disabled." );
|
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) {
|
else if ( manyToOne.getColumn() != null || manyToOne.getFormula() != null) {
|
||||||
throw new MappingException( "column/formula attribute may not be used together with <column>/<formula> subelement" );
|
throw new MappingException( "column/formula attribute may not be used together with <column>/<formula> subelement" );
|
||||||
|
@ -171,19 +169,19 @@ public class HbmSimpleValueRelationalStateContainer implements AbstractAttribute
|
||||||
this.defaults = defaults;
|
this.defaults = defaults;
|
||||||
this.propertyUniqueKeys = Collections.emptySet();
|
this.propertyUniqueKeys = Collections.emptySet();
|
||||||
this.propertyIndexes = Collections.emptySet();
|
this.propertyIndexes = Collections.emptySet();
|
||||||
singleValueStates = new ArrayList<AttributeBinding.SingleValueRelationalState>(
|
simpleValueStates = new ArrayList<SimpleValueRelationalState>(
|
||||||
mappedColumnsOrFormulas == null || mappedColumnsOrFormulas.isEmpty() ?
|
mappedColumnsOrFormulas == null || mappedColumnsOrFormulas.isEmpty() ?
|
||||||
1 :
|
1 :
|
||||||
mappedColumnsOrFormulas.size()
|
mappedColumnsOrFormulas.size()
|
||||||
);
|
);
|
||||||
if ( mappedColumnsOrFormulas != null && ! mappedColumnsOrFormulas.isEmpty() ) {
|
if ( mappedColumnsOrFormulas != null && ! mappedColumnsOrFormulas.isEmpty() ) {
|
||||||
for ( Object mappedColumnOrFormula : mappedColumnsOrFormulas ) {
|
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,
|
HbmSimpleValueRelationalStateContainer container,
|
||||||
Object columnOrFormula) {
|
Object columnOrFormula) {
|
||||||
if ( XMLColumnElement.class.isInstance( 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() );
|
throw new MappingException( "unknown type of column or formula: " + columnOrFormula.getClass().getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AttributeBinding.SingleValueRelationalState> getRelationalStates() {
|
public List<SimpleValueRelationalState> getRelationalStates() {
|
||||||
return singleValueStates;
|
return simpleValueStates;
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> getPropertyUniqueKeys() {
|
Set<String> getPropertyUniqueKeys() {
|
||||||
|
|
|
@ -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<String, MetaAttribute> getMetaAttributes();
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
|
@ -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<String> getUniqueKeys();
|
||||||
|
Set<String> getIndexes();
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
|
@ -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 {
|
||||||
|
}
|
|
@ -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<SimpleValueRelationalState> getRelationalStates();
|
||||||
|
}
|
|
@ -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 {
|
||||||
|
}
|
Loading…
Reference in New Issue