HHH-6447 - Develop shared binding creation approach
This commit is contained in:
parent
49c54069cd
commit
8d3e94ab83
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* 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.source.binder;
|
||||||
|
|
||||||
|
import org.hibernate.engine.spi.CascadeStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contract describing sources for attributes which model associations.
|
||||||
|
*
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public interface AssociationAttributeSource extends AttributeSource {
|
||||||
|
/**
|
||||||
|
* Obtain the cascade styles to be applied to this association.
|
||||||
|
*
|
||||||
|
* @return The cascade styles.
|
||||||
|
*/
|
||||||
|
public Iterable<CascadeStyle> getCascadeStyle();
|
||||||
|
}
|
|
@ -100,6 +100,4 @@ public interface SingularAttributeSource extends AttributeSource, RelationalValu
|
||||||
* @return {@code true} indicates it should be included; {@code false}, it should not.
|
* @return {@code true} indicates it should be included; {@code false}, it should not.
|
||||||
*/
|
*/
|
||||||
public boolean isIncludedInOptimisticLocking();
|
public boolean isIncludedInOptimisticLocking();
|
||||||
|
|
||||||
public Iterable<CascadeStyle> getCascadeStyle();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ package org.hibernate.metamodel.source.binder;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface ToOneAttributeSource extends SingularAttributeSource {
|
public interface ToOneAttributeSource extends SingularAttributeSource, AssociationAttributeSource {
|
||||||
/**
|
/**
|
||||||
* Obtain the name of the referenced entity.
|
* Obtain the name of the referenced entity.
|
||||||
*
|
*
|
||||||
|
|
|
@ -62,15 +62,16 @@ import org.hibernate.service.classloading.spi.ClassLoadingException;
|
||||||
*/
|
*/
|
||||||
public class Helper {
|
public class Helper {
|
||||||
static final Iterable<CascadeStyle> NO_CASCADING = Collections.singleton( CascadeStyle.NONE );
|
static final Iterable<CascadeStyle> NO_CASCADING = Collections.singleton( CascadeStyle.NONE );
|
||||||
|
|
||||||
public static final ExplicitHibernateTypeSource TO_ONE_ATTRIBUTE_TYPE_SOURCE = new ExplicitHibernateTypeSource() {
|
public static final ExplicitHibernateTypeSource TO_ONE_ATTRIBUTE_TYPE_SOURCE = new ExplicitHibernateTypeSource() {
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> getParameters() {
|
public Map<String, String> getParameters() {
|
||||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -129,11 +129,6 @@ class PropertyAttributeSourceImpl implements SingularAttributeSource {
|
||||||
return Helper.getBooleanValue( propertyElement.isOptimisticLock(), true );
|
return Helper.getBooleanValue( propertyElement.isOptimisticLock(), true );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<CascadeStyle> getCascadeStyle() {
|
|
||||||
return Helper.NO_CASCADING;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SingularAttributeNature getNature() {
|
public SingularAttributeNature getNature() {
|
||||||
return SingularAttributeNature.BASIC;
|
return SingularAttributeNature.BASIC;
|
||||||
|
|
|
@ -133,11 +133,6 @@ class SingularIdentifierAttributeSourceImpl implements SingularAttributeSource {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<CascadeStyle> getCascadeStyle() {
|
|
||||||
return Helper.NO_CASCADING;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SingularAttributeNature getNature() {
|
public SingularAttributeNature getNature() {
|
||||||
return SingularAttributeNature.BASIC;
|
return SingularAttributeNature.BASIC;
|
||||||
|
|
|
@ -144,11 +144,6 @@ class TimestampAttributeSourceImpl implements SingularAttributeSource {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<CascadeStyle> getCascadeStyle() {
|
|
||||||
return Helper.NO_CASCADING;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SingularAttributeNature getNature() {
|
public SingularAttributeNature getNature() {
|
||||||
return SingularAttributeNature.BASIC;
|
return SingularAttributeNature.BASIC;
|
||||||
|
|
|
@ -144,11 +144,6 @@ class VersionAttributeSourceImpl implements SingularAttributeSource {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<CascadeStyle> getCascadeStyle() {
|
|
||||||
return Helper.NO_CASCADING;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SingularAttributeNature getNature() {
|
public SingularAttributeNature getNature() {
|
||||||
return SingularAttributeNature.BASIC;
|
return SingularAttributeNature.BASIC;
|
||||||
|
|
Loading…
Reference in New Issue