HHH-6168 : test for many-to-one AttributeBinding and misc corrections
This commit is contained in:
parent
1ae1d4b699
commit
b667767f85
|
@ -109,12 +109,20 @@ public abstract class AbstractAttributeBinding implements AttributeBinding {
|
||||||
this.attribute = attribute;
|
this.attribute = attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initializeColumnValue(ColumnRelationalState state, boolean forceNonNullable, boolean forceUnique) {
|
protected boolean forceNonNullable() {
|
||||||
Column columnValue = createColumn( state, forceNonNullable, forceUnique );
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean forceUnique() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initializeColumnValue(ColumnRelationalState state) {
|
||||||
|
Column columnValue = createColumn( state );
|
||||||
setValue( columnValue );
|
setValue( columnValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
private Column createColumn(ColumnRelationalState state, boolean forceNonNullable, boolean forceUnique) {
|
private Column createColumn(ColumnRelationalState state) {
|
||||||
final String explicitName = state.getExplicitColumnName();
|
final String explicitName = state.getExplicitColumnName();
|
||||||
final String logicalColumnName = state.getNamingStrategy().logicalColumnName( explicitName, getAttribute().getName() );
|
final String logicalColumnName = state.getNamingStrategy().logicalColumnName( explicitName, getAttribute().getName() );
|
||||||
final TableSpecification table = getEntityBinding().getBaseTable();
|
final TableSpecification table = getEntityBinding().getBaseTable();
|
||||||
|
@ -126,8 +134,8 @@ public abstract class AbstractAttributeBinding implements AttributeBinding {
|
||||||
// mappings.addColumnBinding( logicalColumnName, column, table );
|
// mappings.addColumnBinding( logicalColumnName, column, table );
|
||||||
Column columnValue = table.createColumn( columnName );
|
Column columnValue = table.createColumn( columnName );
|
||||||
columnValue.getSize().initialize( state.getSize() );
|
columnValue.getSize().initialize( state.getSize() );
|
||||||
columnValue.setNullable( ! forceNonNullable && state.isNullable() );
|
columnValue.setNullable( ! forceNonNullable() && state.isNullable() );
|
||||||
columnValue.setUnique( ! forceUnique && state.isUnique() );
|
columnValue.setUnique( ! forceUnique() && state.isUnique() );
|
||||||
columnValue.setCheckCondition( state.getCheckCondition() );
|
columnValue.setCheckCondition( state.getCheckCondition() );
|
||||||
columnValue.setDefaultValue( state.getDefault() );
|
columnValue.setDefaultValue( state.getDefault() );
|
||||||
columnValue.setSqlType( state.getSqlType() );
|
columnValue.setSqlType( state.getSqlType() );
|
||||||
|
@ -143,6 +151,16 @@ public abstract class AbstractAttributeBinding implements AttributeBinding {
|
||||||
return columnValue;
|
return columnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final void initialize(RelationalState state) {
|
||||||
|
if ( SingleValueRelationalState.class.isInstance( state ) ) {
|
||||||
|
initializeSingleValue( SingleValueRelationalState.class.cast( state ) );
|
||||||
|
}
|
||||||
|
else if ( SimpleTupleRelationalState.class.isInstance( state ) ) {
|
||||||
|
initializeTupleValue( SimpleTupleRelationalState.class.cast( state ).getRelationalStates() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public final <T extends DerivedRelationalState> void initializeDerivedValue(T state) {
|
public final <T extends DerivedRelationalState> void initializeDerivedValue(T state) {
|
||||||
value = createDerivedValue( state );
|
value = createDerivedValue( state );
|
||||||
}
|
}
|
||||||
|
@ -151,13 +169,13 @@ public abstract class AbstractAttributeBinding implements AttributeBinding {
|
||||||
return getEntityBinding().getBaseTable().createDerivedValue( state.getFormula() );
|
return getEntityBinding().getBaseTable().createDerivedValue( state.getFormula() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void initializeSingleValue(SingleValueRelationalState state, boolean forceNonNullable, boolean forceUnique) {
|
public final void initializeSingleValue(SingleValueRelationalState state) {
|
||||||
value = createSingleValue( state, forceNonNullable, forceUnique );
|
value = createSingleValue( state );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SimpleValue createSingleValue(SingleValueRelationalState state, boolean forceNonNullable, boolean forceUnique) {
|
protected SimpleValue createSingleValue(SingleValueRelationalState state) {
|
||||||
if ( state instanceof ColumnRelationalState ) {
|
if ( state instanceof ColumnRelationalState ) {
|
||||||
return createColumn( ColumnRelationalState.class.cast( state ), forceNonNullable, forceUnique );
|
return createColumn( ColumnRelationalState.class.cast( state ) );
|
||||||
}
|
}
|
||||||
else if ( state instanceof DerivedRelationalState ) {
|
else if ( state instanceof DerivedRelationalState ) {
|
||||||
return createDerivedValue( DerivedRelationalState.class.cast( state ) );
|
return createDerivedValue( DerivedRelationalState.class.cast( state ) );
|
||||||
|
@ -167,12 +185,20 @@ public abstract class AbstractAttributeBinding implements AttributeBinding {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void initializeTupleValue(Set<SingleValueRelationalState> singleValueStates, boolean forceNonNullable, boolean forceUnique) {
|
protected final void initializeTupleValue(Set<SingleValueRelationalState> singleValueStates) {
|
||||||
Tuple tuple = getEntityBinding().getBaseTable().createTuple( "[" + getAttribute().getName() + "]" );
|
if ( singleValueStates.size() == 0 ) {
|
||||||
for ( SingleValueRelationalState singleValueState : singleValueStates ) {
|
throw new MappingException( "Tuple state does not contain any values." );
|
||||||
tuple.addValue( createSingleValue( singleValueState, forceNonNullable, forceUnique ) );
|
}
|
||||||
|
if ( singleValueStates.size() == 1 ) {
|
||||||
|
initializeSingleValue( singleValueStates.iterator().next() );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Tuple tuple = getEntityBinding().getBaseTable().createTuple( "[" + getAttribute().getName() + "]" );
|
||||||
|
for ( SingleValueRelationalState singleValueState : singleValueStates ) {
|
||||||
|
tuple.addValue( createSingleValue( singleValueState ) );
|
||||||
|
}
|
||||||
|
value = tuple;
|
||||||
}
|
}
|
||||||
value = tuple;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -290,6 +316,10 @@ public abstract class AbstractAttributeBinding implements AttributeBinding {
|
||||||
entityReferencingAttributeBindings.add( referencingAttributeBinding );
|
entityReferencingAttributeBindings.add( referencingAttributeBinding );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<EntityReferencingAttributeBinding> getEntityReferencingAttributeBindings() {
|
||||||
|
return Collections.unmodifiableSet( entityReferencingAttributeBindings );
|
||||||
|
}
|
||||||
|
|
||||||
public void validate() {
|
public void validate() {
|
||||||
if ( ! entityReferencingAttributeBindings.isEmpty() ) {
|
if ( ! entityReferencingAttributeBindings.isEmpty() ) {
|
||||||
// TODO; validate that this AttributeBinding can be a target of an entity reference
|
// TODO; validate that this AttributeBinding can be a target of an entity reference
|
||||||
|
@ -298,9 +328,11 @@ public abstract class AbstractAttributeBinding implements AttributeBinding {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static interface SingleValueRelationalState {}
|
public static interface RelationalState {}
|
||||||
|
|
||||||
public static interface ColumnRelationalState extends SimpleAttributeBinding.SingleValueRelationalState {
|
public static interface SingleValueRelationalState extends RelationalState {}
|
||||||
|
|
||||||
|
public static interface ColumnRelationalState extends SingleValueRelationalState {
|
||||||
NamingStrategy getNamingStrategy();
|
NamingStrategy getNamingStrategy();
|
||||||
String getExplicitColumnName();
|
String getExplicitColumnName();
|
||||||
boolean isUnique();
|
boolean isUnique();
|
||||||
|
@ -320,4 +352,10 @@ public abstract class AbstractAttributeBinding implements AttributeBinding {
|
||||||
String getFormula();
|
String getFormula();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static interface SimpleTupleRelationalState extends TupleRelationalState<SingleValueRelationalState> {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface TupleRelationalState<T extends RelationalState> extends RelationalState{
|
||||||
|
Set<T> getRelationalStates();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
package org.hibernate.metamodel.binding;
|
package org.hibernate.metamodel.binding;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.metamodel.domain.Attribute;
|
import org.hibernate.metamodel.domain.Attribute;
|
||||||
import org.hibernate.metamodel.domain.MetaAttribute;
|
import org.hibernate.metamodel.domain.MetaAttribute;
|
||||||
|
@ -104,6 +105,7 @@ public interface AttributeBinding {
|
||||||
public boolean isLazy();
|
public boolean isLazy();
|
||||||
|
|
||||||
public void addEntityReferencingAttributeBinding(EntityReferencingAttributeBinding attributeBinding);
|
public void addEntityReferencingAttributeBinding(EntityReferencingAttributeBinding attributeBinding);
|
||||||
|
public Set<EntityReferencingAttributeBinding> getEntityReferencingAttributeBindings();
|
||||||
|
|
||||||
public void validate();
|
public void validate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.hibernate.metamodel.relational.Value;
|
||||||
*/
|
*/
|
||||||
public interface EntityReferencingAttributeBinding extends AttributeBinding {
|
public interface EntityReferencingAttributeBinding extends AttributeBinding {
|
||||||
boolean isReferenceResolved();
|
boolean isReferenceResolved();
|
||||||
|
boolean isPropertyReference();
|
||||||
String getReferencedEntityName();
|
String getReferencedEntityName();
|
||||||
String getReferencedAttributeName();
|
String getReferencedAttributeName();
|
||||||
EntityBinding getReferencedEntityBinding();
|
EntityBinding getReferencedEntityBinding();
|
||||||
|
|
|
@ -26,10 +26,10 @@ package org.hibernate.metamodel.binding;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
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.source.Metadata;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO : javadoc
|
* TODO : javadoc
|
||||||
|
@ -52,7 +52,7 @@ public class ManyToOneAttributeBinding extends SingularAttributeBinding implemen
|
||||||
boolean ignoreNotFound();
|
boolean ignoreNotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static interface RelationalState extends SingleValueRelationalState {
|
public static interface ManyToOneRelationalState extends RelationalState {
|
||||||
boolean isLogicalOneToOne();
|
boolean isLogicalOneToOne();
|
||||||
String getForeignKeyName();
|
String getForeignKeyName();
|
||||||
}
|
}
|
||||||
|
@ -66,14 +66,25 @@ public class ManyToOneAttributeBinding extends SingularAttributeBinding implemen
|
||||||
isPropertyReference = state.getReferencedAttributeName() != null;
|
isPropertyReference = state.getReferencedAttributeName() != null;
|
||||||
referencedAttributeName = state.getReferencedAttributeName();
|
referencedAttributeName = state.getReferencedAttributeName();
|
||||||
referencedEntityName = state.getReferencedEntityName();
|
referencedEntityName = state.getReferencedEntityName();
|
||||||
|
if ( referencedEntityName == null ) {
|
||||||
|
referencedEntityName =
|
||||||
|
ReflectHelper.reflectedPropertyClass(
|
||||||
|
getEntityBinding().getEntity().getName(),
|
||||||
|
state.getAttribute().getName()
|
||||||
|
).getName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void initialize(RelationalState state) {
|
public final void initialize(ManyToOneRelationalState state) {
|
||||||
super.initializeSingleValue( state );
|
super.initialize( state );
|
||||||
isLogicalOneToOne = state.isLogicalOneToOne();
|
isLogicalOneToOne = state.isLogicalOneToOne();
|
||||||
foreignKeyName = state.getForeignKeyName();
|
foreignKeyName = state.getForeignKeyName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final boolean isPropertyReference() {
|
||||||
|
return isPropertyReference;
|
||||||
|
}
|
||||||
|
|
||||||
public final String getReferencedEntityName() {
|
public final String getReferencedEntityName() {
|
||||||
return referencedEntityName;
|
return referencedEntityName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,15 +23,8 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.metamodel.binding;
|
package org.hibernate.metamodel.binding;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.mapping.PropertyGeneration;
|
import org.hibernate.mapping.PropertyGeneration;
|
||||||
import org.hibernate.metamodel.relational.Column;
|
|
||||||
import org.hibernate.metamodel.relational.DerivedValue;
|
|
||||||
import org.hibernate.metamodel.relational.SimpleValue;
|
|
||||||
import org.hibernate.metamodel.relational.TableSpecification;
|
|
||||||
import org.hibernate.metamodel.relational.Tuple;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO : javadoc
|
* TODO : javadoc
|
||||||
|
@ -54,15 +47,15 @@ public class SimpleAttributeBinding extends SingularAttributeBinding {
|
||||||
generation = state.getPropertyGeneration();
|
generation = state.getPropertyGeneration();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void initializeTupleValue(TupleRelationalState state) {
|
public final void initializeTupleValue(SimpleTupleRelationalState state) {
|
||||||
if ( state.getSingleValueRelationalStates().size() == 0 ) {
|
if ( state.getRelationalStates().size() == 0 ) {
|
||||||
throw new MappingException( "Tuple state does not contain any values." );
|
throw new MappingException( "Tuple state does not contain any values." );
|
||||||
}
|
}
|
||||||
if ( state.getSingleValueRelationalStates().size() == 1 ) {
|
if ( state.getRelationalStates().size() == 1 ) {
|
||||||
initializeSingleValue( state.getSingleValueRelationalStates().iterator().next() );
|
initializeSingleValue( state.getRelationalStates().iterator().next() );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
initializeTupleValue( state.getSingleValueRelationalStates() );
|
initializeTupleValue( state.getRelationalStates() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +76,4 @@ public class SimpleAttributeBinding extends SingularAttributeBinding {
|
||||||
return generation;
|
return generation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static interface TupleRelationalState {
|
|
||||||
Set<SingleValueRelationalState> getSingleValueRelationalStates();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,13 +23,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.metamodel.binding;
|
package org.hibernate.metamodel.binding;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
|
||||||
import org.hibernate.metamodel.relational.DerivedValue;
|
|
||||||
import org.hibernate.metamodel.relational.SimpleValue;
|
|
||||||
import org.hibernate.metamodel.relational.Tuple;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO : javadoc
|
* TODO : javadoc
|
||||||
*
|
*
|
||||||
|
@ -64,18 +57,6 @@ public abstract class SingularAttributeBinding extends AbstractAttributeBinding
|
||||||
unsavedValue = state.getUnsavedValue();
|
unsavedValue = state.getUnsavedValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void initializeColumnValue(ColumnRelationalState state) {
|
|
||||||
initializeColumnValue( state, forceNonNullable, forceUnique );
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void initializeSingleValue(SingleValueRelationalState state) {
|
|
||||||
initializeSingleValue( state, forceNonNullable, forceUnique );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void initializeTupleValue(Set<SingleValueRelationalState> singleValueStates) {
|
|
||||||
initializeTupleValue( singleValueStates, forceNonNullable, forceUnique );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInsertable() {
|
public boolean isInsertable() {
|
||||||
return insertable;
|
return insertable;
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,11 +315,11 @@ public class EntityBinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AnnotationSimpleAttributeRelationalState
|
public static class AnnotationSimpleAttributeRelationalState
|
||||||
implements SimpleAttributeBinding.TupleRelationalState {
|
implements SimpleAttributeBinding.SimpleTupleRelationalState {
|
||||||
LinkedHashSet<SimpleAttributeBinding.SingleValueRelationalState> valueStates = new LinkedHashSet<SimpleAttributeBinding.SingleValueRelationalState>();
|
LinkedHashSet<SimpleAttributeBinding.SingleValueRelationalState> valueStates = new LinkedHashSet<SimpleAttributeBinding.SingleValueRelationalState>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LinkedHashSet<SimpleAttributeBinding.SingleValueRelationalState> getSingleValueRelationalStates() {
|
public LinkedHashSet<SimpleAttributeBinding.SingleValueRelationalState> getRelationalStates() {
|
||||||
return valueStates;
|
return valueStates;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,28 +25,14 @@ package org.hibernate.metamodel.source.hbm.state.domain;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.dom4j.Attribute;
|
|
||||||
import org.dom4j.Element;
|
|
||||||
|
|
||||||
import org.hibernate.FetchMode;
|
import org.hibernate.FetchMode;
|
||||||
import org.hibernate.MappingException;
|
|
||||||
import org.hibernate.cfg.HbmBinder;
|
|
||||||
import org.hibernate.cfg.Mappings;
|
|
||||||
import org.hibernate.mapping.Fetchable;
|
|
||||||
import org.hibernate.mapping.OneToOne;
|
|
||||||
import org.hibernate.mapping.PropertyGeneration;
|
|
||||||
import org.hibernate.metamodel.binding.EntityBinding;
|
|
||||||
import org.hibernate.metamodel.binding.HibernateTypeDescriptor;
|
import org.hibernate.metamodel.binding.HibernateTypeDescriptor;
|
||||||
import org.hibernate.metamodel.binding.ManyToOneAttributeBinding;
|
import org.hibernate.metamodel.binding.ManyToOneAttributeBinding;
|
||||||
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.Metadata;
|
|
||||||
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.DomHelper;
|
|
||||||
import org.hibernate.metamodel.source.util.MappingHelper;
|
import org.hibernate.metamodel.source.util.MappingHelper;
|
||||||
import org.hibernate.tuple.component.Dom4jComponentTuplizer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
|
@ -56,8 +42,16 @@ public class HbmManyToOneAttributeDomainState
|
||||||
implements ManyToOneAttributeBinding.DomainState {
|
implements ManyToOneAttributeBinding.DomainState {
|
||||||
|
|
||||||
private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor();
|
||||||
private final XMLManyToOneElement manyToOne;
|
private final FetchMode fetchMode;
|
||||||
|
private final boolean isUnwrapProxy;
|
||||||
|
private final boolean isLazy;
|
||||||
private final String cascade;
|
private final String cascade;
|
||||||
|
private final boolean isEmbedded;
|
||||||
|
private final String referencedPropertyName;
|
||||||
|
private final String referencedEntityName;
|
||||||
|
private final boolean ignoreNotFound;
|
||||||
|
private final boolean isInsertable;
|
||||||
|
private final boolean isUpdateable;
|
||||||
|
|
||||||
public HbmManyToOneAttributeDomainState(MappingDefaults defaults,
|
public HbmManyToOneAttributeDomainState(MappingDefaults defaults,
|
||||||
org.hibernate.metamodel.domain.Attribute attribute,
|
org.hibernate.metamodel.domain.Attribute attribute,
|
||||||
|
@ -71,15 +65,29 @@ public class HbmManyToOneAttributeDomainState
|
||||||
HbmHelper.getPropertyAccessorName( manyToOne.getAccess(), manyToOne.isEmbedXml(), defaults.getDefaultAccess() ),
|
HbmHelper.getPropertyAccessorName( manyToOne.getAccess(), manyToOne.isEmbedXml(), defaults.getDefaultAccess() ),
|
||||||
manyToOne.isOptimisticLock()
|
manyToOne.isOptimisticLock()
|
||||||
);
|
);
|
||||||
|
fetchMode = getFetchMode( manyToOne );
|
||||||
this.hibernateTypeDescriptor.setTypeName( getReferencedEntityName() );
|
isUnwrapProxy = manyToOne.getLazy() != null && "no-proxy".equals( manyToOne.getLazy().value() );
|
||||||
this.manyToOne = manyToOne;
|
//TODO: better to degrade to lazy="false" if uninstrumented
|
||||||
this.cascade = MappingHelper.getStringValue( manyToOne.getCascade(), defaults.getDefaultCascade() );
|
isLazy = manyToOne.getLazy() == null ||
|
||||||
|
isUnwrapProxy ||
|
||||||
|
"proxy".equals( manyToOne.getLazy().value() );
|
||||||
|
cascade = MappingHelper.getStringValue( manyToOne.getCascade(), defaults.getDefaultCascade() );
|
||||||
|
isEmbedded = manyToOne.isEmbedXml();
|
||||||
|
hibernateTypeDescriptor.setTypeName( getReferencedEntityName() );
|
||||||
|
referencedPropertyName = manyToOne.getPropertyRef();
|
||||||
|
referencedEntityName = (
|
||||||
|
manyToOne.getEntityName() == null ?
|
||||||
|
HbmHelper.getClassName( manyToOne.getClazz(), getDefaults().getPackageName() ) :
|
||||||
|
manyToOne.getEntityName().intern()
|
||||||
|
);
|
||||||
|
ignoreNotFound = "ignore".equals( manyToOne.getNotFound().value() );
|
||||||
|
isInsertable = manyToOne.isInsert();
|
||||||
|
isUpdateable = manyToOne.isUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: is this needed???
|
// TODO: is this needed???
|
||||||
protected boolean isEmbedded() {
|
protected boolean isEmbedded() {
|
||||||
return MappingHelper.getBooleanValue( manyToOne.isEmbedXml(), true );
|
return isEmbedded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HibernateTypeDescriptor getHibernateTypeDescriptor() {
|
public HibernateTypeDescriptor getHibernateTypeDescriptor() {
|
||||||
|
@ -87,13 +95,13 @@ public class HbmManyToOneAttributeDomainState
|
||||||
}
|
}
|
||||||
|
|
||||||
// same as for plural attributes...
|
// same as for plural attributes...
|
||||||
public FetchMode getFetchMode() {
|
private static FetchMode getFetchMode(XMLManyToOneElement manyToOne) {
|
||||||
FetchMode fetchMode;
|
FetchMode fetchMode;
|
||||||
if ( manyToOne.getFetch() != null ) {
|
if ( manyToOne.getFetch() != null ) {
|
||||||
fetchMode = "join".equals( manyToOne.getFetch() ) ? FetchMode.JOIN : FetchMode.SELECT;
|
fetchMode = "join".equals( manyToOne.getFetch().value() ) ? FetchMode.JOIN : FetchMode.SELECT;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String jfNodeValue = ( manyToOne.getOuterJoin().value() == null ? "auto" : manyToOne.getOuterJoin().value() );
|
String jfNodeValue = ( manyToOne.getOuterJoin() == null ? "auto" : manyToOne.getOuterJoin().value() );
|
||||||
if ( "auto".equals( jfNodeValue ) ) {
|
if ( "auto".equals( jfNodeValue ) ) {
|
||||||
fetchMode = FetchMode.DEFAULT;
|
fetchMode = FetchMode.DEFAULT;
|
||||||
}
|
}
|
||||||
|
@ -107,54 +115,40 @@ public class HbmManyToOneAttributeDomainState
|
||||||
return fetchMode;
|
return fetchMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FetchMode getFetchMode() {
|
||||||
|
return fetchMode;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isLazy() {
|
public boolean isLazy() {
|
||||||
return manyToOne.getLazy() == null ||
|
return isLazy;
|
||||||
isUnwrapProxy() ||
|
|
||||||
manyToOne.getLazy().equals( "proxy" );
|
|
||||||
//TODO: better to degrade to lazy="false" if uninstrumented
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUnwrapProxy() {
|
public boolean isUnwrapProxy() {
|
||||||
return "no-proxy".equals( manyToOne.getLazy() );
|
return isUnwrapProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReferencedAttributeName() {
|
public String getReferencedAttributeName() {
|
||||||
return manyToOne.getPropertyRef();
|
return referencedPropertyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReferencedEntityName() {
|
public String getReferencedEntityName() {
|
||||||
String entityName = manyToOne.getEntityName();
|
return referencedEntityName;
|
||||||
return entityName == null ?
|
|
||||||
HbmHelper.getClassName( manyToOne.getClazz(), getDefaults().getPackageName() ) :
|
|
||||||
entityName.intern();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCascade() {
|
public String getCascade() {
|
||||||
return MappingHelper.getStringValue( manyToOne.getCascade(), getDefaults().getDefaultCascade() );
|
return cascade;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ignoreNotFound() {
|
public boolean ignoreNotFound() {
|
||||||
return "ignore".equals( manyToOne.getNotFound() );
|
return ignoreNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void junk() {
|
|
||||||
if( getReferencedPropertyName() != null && ! ignoreNotFound() ) {
|
|
||||||
mappings.addSecondPass( new ManyToOneSecondPass(manyToOne) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public boolean isInsertable() {
|
public boolean isInsertable() {
|
||||||
return MappingHelper.getBooleanValue( manyToOne.isInsert(), true );
|
return isInsertable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUpdateable() {
|
public boolean isUpdateable() {
|
||||||
return MappingHelper.getBooleanValue( manyToOne.isUnique(), true );
|
return isUpdateable;
|
||||||
}
|
|
||||||
|
|
||||||
public String getForeignkeyName() {
|
|
||||||
return manyToOne.getForeignKey();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isKeyCasadeDeleteEnabled() {
|
public boolean isKeyCasadeDeleteEnabled() {
|
||||||
|
|
|
@ -30,10 +30,10 @@ 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.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.binding.SimpleAttributeBinding;
|
||||||
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;
|
||||||
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLId;
|
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping.XMLClass.XMLId;
|
||||||
|
@ -45,7 +45,7 @@ import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertyElement;
|
||||||
/**
|
/**
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
public class HbmSimpleValueRelationalStateContainer implements SimpleAttributeBinding.TupleRelationalState {
|
public class HbmSimpleValueRelationalStateContainer implements AbstractAttributeBinding.SimpleTupleRelationalState {
|
||||||
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;
|
||||||
|
@ -196,7 +196,7 @@ public class HbmSimpleValueRelationalStateContainer implements SimpleAttributeBi
|
||||||
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 Set<SimpleAttributeBinding.SingleValueRelationalState> getSingleValueRelationalStates() {
|
public Set<SimpleAttributeBinding.SingleValueRelationalState> getRelationalStates() {
|
||||||
return singleValueStates;
|
return singleValueStates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,9 +59,9 @@ class EntityReferenceResolver {
|
||||||
"] refers to unknown entity: [" + attributeBinding.getReferencedEntityName() + "]" );
|
"] refers to unknown entity: [" + attributeBinding.getReferencedEntityName() + "]" );
|
||||||
}
|
}
|
||||||
AttributeBinding referencedAttributeBinding =
|
AttributeBinding referencedAttributeBinding =
|
||||||
attributeBinding.getReferencedAttributeName() == null ?
|
attributeBinding.isPropertyReference() ?
|
||||||
entityBinding.getEntityIdentifier().getValueBinding() :
|
entityBinding.getAttributeBinding( attributeBinding.getReferencedAttributeName() ) :
|
||||||
entityBinding.getAttributeBinding( attributeBinding.getReferencedAttributeName() );
|
entityBinding.getEntityIdentifier().getValueBinding();
|
||||||
if ( referencedAttributeBinding == null ) {
|
if ( referencedAttributeBinding == null ) {
|
||||||
// TODO: does attribute name include path w/ entity name?
|
// TODO: does attribute name include path w/ entity name?
|
||||||
throw new MappingException(
|
throw new MappingException(
|
||||||
|
|
|
@ -23,7 +23,12 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.metamodel.binding;
|
package org.hibernate.metamodel.binding;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.hibernate.metamodel.relational.Column;
|
import org.hibernate.metamodel.relational.Column;
|
||||||
|
import org.hibernate.metamodel.source.Metadata;
|
||||||
|
import org.hibernate.metamodel.source.internal.MetadataImpl;
|
||||||
|
import org.hibernate.metamodel.source.spi.MetadataImplementor;
|
||||||
import org.hibernate.service.BasicServiceRegistry;
|
import org.hibernate.service.BasicServiceRegistry;
|
||||||
import org.hibernate.service.ServiceRegistryBuilder;
|
import org.hibernate.service.ServiceRegistryBuilder;
|
||||||
import org.hibernate.service.internal.BasicServiceRegistryImpl;
|
import org.hibernate.service.internal.BasicServiceRegistryImpl;
|
||||||
|
@ -34,6 +39,7 @@ import org.junit.Test;
|
||||||
|
|
||||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||||
|
|
||||||
|
import static junit.framework.Assert.assertFalse;
|
||||||
import static junit.framework.Assert.assertNotNull;
|
import static junit.framework.Assert.assertNotNull;
|
||||||
import static junit.framework.Assert.assertNull;
|
import static junit.framework.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertSame;
|
import static org.junit.Assert.assertSame;
|
||||||
|
@ -64,7 +70,10 @@ public abstract class AbstractBasicBindingTests extends BaseUnitTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleEntityMapping() {
|
public void testSimpleEntityMapping() {
|
||||||
EntityBinding entityBinding = buildSimpleEntityBinding();
|
checkSimpleEntityMaping( buildSimpleEntityBinding() );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void checkSimpleEntityMaping(EntityBinding entityBinding) {
|
||||||
assertNotNull( entityBinding );
|
assertNotNull( entityBinding );
|
||||||
assertNotNull( entityBinding.getEntityIdentifier() );
|
assertNotNull( entityBinding.getEntityIdentifier() );
|
||||||
assertNotNull( entityBinding.getEntityIdentifier().getValueBinding() );
|
assertNotNull( entityBinding.getEntityIdentifier().getValueBinding() );
|
||||||
|
@ -105,6 +114,21 @@ public abstract class AbstractBasicBindingTests extends BaseUnitTestCase {
|
||||||
assertNotNull( nameBinding.getValue() );
|
assertNotNull( nameBinding.getValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEntityWithManyToOneMapping() {
|
||||||
|
MetadataImplementor metadata = buildMetadataWithManyToOne();
|
||||||
|
EntityBinding entityWithManyToOneBinding = metadata.getEntityBinding( EntityWithManyToOne.class.getName() );
|
||||||
|
EntityBinding simpleEntityBinding = metadata.getEntityBinding( SimpleEntity.class.getName() );
|
||||||
|
checkSimpleEntityMaping( simpleEntityBinding );
|
||||||
|
|
||||||
|
assertTrue(
|
||||||
|
1 == simpleEntityBinding.getAttributeBinding( "id" ).getEntityReferencingAttributeBindings().size()
|
||||||
|
);
|
||||||
|
Iterator<EntityReferencingAttributeBinding> it = entityWithManyToOneBinding.getEntityReferencingAttributeBindings().iterator();
|
||||||
|
assertTrue( it.hasNext() );
|
||||||
|
assertSame( entityWithManyToOneBinding.getAttributeBinding( "simpleEntity" ), it.next() );
|
||||||
|
assertFalse( it.hasNext() );
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
@Test
|
@Test
|
||||||
public void testEntityWithElementCollection() {
|
public void testEntityWithElementCollection() {
|
||||||
|
@ -133,5 +157,7 @@ public abstract class AbstractBasicBindingTests extends BaseUnitTestCase {
|
||||||
|
|
||||||
public abstract EntityBinding buildSimpleEntityBinding();
|
public abstract EntityBinding buildSimpleEntityBinding();
|
||||||
|
|
||||||
|
public abstract MetadataImplementor buildMetadataWithManyToOne();
|
||||||
|
|
||||||
//public abstract EntityBinding buildEntityWithElementCollectionBinding();
|
//public abstract EntityBinding buildEntityWithElementCollectionBinding();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,10 @@ package org.hibernate.metamodel.binding;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import org.hibernate.metamodel.source.Metadata;
|
||||||
import org.hibernate.metamodel.source.MetadataSources;
|
import org.hibernate.metamodel.source.MetadataSources;
|
||||||
import org.hibernate.metamodel.source.internal.MetadataImpl;
|
import org.hibernate.metamodel.source.internal.MetadataImpl;
|
||||||
|
import org.hibernate.metamodel.source.spi.MetadataImplementor;
|
||||||
import org.hibernate.service.ServiceRegistryBuilder;
|
import org.hibernate.service.ServiceRegistryBuilder;
|
||||||
import org.hibernate.testing.FailureExpected;
|
import org.hibernate.testing.FailureExpected;
|
||||||
|
|
||||||
|
@ -49,6 +51,12 @@ public class BasicAnnotationBindingTests extends AbstractBasicBindingTests {
|
||||||
super.testSimpleVersionedEntityMapping();
|
super.testSimpleVersionedEntityMapping();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FailureExpected(jiraKey = "HHH-6172", message = "Work in progress")
|
||||||
|
@Test
|
||||||
|
public void testEntityWithManyToOneMapping() {
|
||||||
|
super.testEntityWithManyToOneMapping();
|
||||||
|
}
|
||||||
|
|
||||||
public EntityBinding buildSimpleEntityBinding() {
|
public EntityBinding buildSimpleEntityBinding() {
|
||||||
MetadataSources sources = new MetadataSources( new ServiceRegistryBuilder().buildServiceRegistry() );
|
MetadataSources sources = new MetadataSources( new ServiceRegistryBuilder().buildServiceRegistry() );
|
||||||
sources.addAnnotatedClass( SimpleEntity.class );
|
sources.addAnnotatedClass( SimpleEntity.class );
|
||||||
|
@ -64,4 +72,11 @@ public class BasicAnnotationBindingTests extends AbstractBasicBindingTests {
|
||||||
|
|
||||||
return metadata.getEntityBinding( SimpleVersionedEntity.class.getSimpleName() );
|
return metadata.getEntityBinding( SimpleVersionedEntity.class.getSimpleName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MetadataImplementor buildMetadataWithManyToOne() {
|
||||||
|
MetadataSources sources = new MetadataSources( new ServiceRegistryBuilder().buildServiceRegistry() );
|
||||||
|
sources.addAnnotatedClass( EntityWithManyToOne.class );
|
||||||
|
sources.addAnnotatedClass( SimpleVersionedEntity.class );
|
||||||
|
return ( MetadataImplementor ) sources.buildMetadata();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,15 +23,11 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.metamodel.binding;
|
package org.hibernate.metamodel.binding;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
import org.hibernate.metamodel.source.MetadataSources;
|
import org.hibernate.metamodel.source.MetadataSources;
|
||||||
import org.hibernate.metamodel.source.internal.JaxbRoot;
|
|
||||||
import org.hibernate.metamodel.source.internal.MetadataImpl;
|
import org.hibernate.metamodel.source.internal.MetadataImpl;
|
||||||
|
import org.hibernate.metamodel.source.spi.MetadataImplementor;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -59,6 +55,14 @@ public class BasicHbmBindingTests extends AbstractBasicBindingTests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MetadataImplementor buildMetadataWithManyToOne() {
|
||||||
|
MetadataSources metadataSources = new MetadataSources( basicServiceRegistry() );
|
||||||
|
metadataSources.addResource( "org/hibernate/metamodel/binding/EntityWithManyToOne.hbm.xml" );
|
||||||
|
metadataSources.addResource( "org/hibernate/metamodel/binding/SimpleEntity.hbm.xml" );
|
||||||
|
assertEquals( 2, metadataSources.getJaxbRootList().size() );
|
||||||
|
return ( MetadataImplementor ) metadataSources.buildMetadata();
|
||||||
|
}
|
||||||
|
|
||||||
private EntityBinding getEntityBinding(String resourceName, String entityName ) {
|
private EntityBinding getEntityBinding(String resourceName, String entityName ) {
|
||||||
MetadataSources metadataSources = new MetadataSources( basicServiceRegistry() );
|
MetadataSources metadataSources = new MetadataSources( basicServiceRegistry() );
|
||||||
metadataSources.addResource( resourceName );
|
metadataSources.addResource( resourceName );
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<hhh:hibernate-mapping package="org.hibernate.metamodel.binding" xmlns:hhh="http://www.hibernate.org/xsd/hibernate-mapping"
|
||||||
|
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping hibernate-mapping-4.0.xsd"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
|
||||||
|
<class name="EntityWithManyToOne">
|
||||||
|
|
||||||
|
<id name="id">
|
||||||
|
<generator class="increment"/>
|
||||||
|
</id>
|
||||||
|
<property name="name"/>
|
||||||
|
<many-to-one name="simpleEntity"/>
|
||||||
|
</class>
|
||||||
|
|
||||||
|
</hhh:hibernate-mapping>
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.metamodel.binding;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Gail Badner
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
public class EntityWithManyToOne {
|
||||||
|
@Id
|
||||||
|
private Long id;
|
||||||
|
private String theName;
|
||||||
|
SimpleEntity simpleEntity;
|
||||||
|
|
||||||
|
public EntityWithManyToOne() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityWithManyToOne(String name) {
|
||||||
|
this.theName = theName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return theName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.theName = theName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
public SimpleEntity getSimpleEntity() {
|
||||||
|
return simpleEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSimpleEntity(SimpleEntity simpleEntity) {
|
||||||
|
this.simpleEntity = simpleEntity;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue