HHH-8629 : Integrate LoadPlans into collection initializers

This commit is contained in:
Gail Badner 2013-11-06 12:42:00 -08:00
parent e65abd026c
commit dd28adb1ae
11 changed files with 212 additions and 143 deletions

View File

@ -29,7 +29,6 @@ import org.hibernate.loader.plan2.build.spi.LoadPlanBuildingContext;
import org.hibernate.loader.plan2.spi.CollectionFetchableElement;
import org.hibernate.loader.plan2.spi.CollectionFetchableIndex;
import org.hibernate.loader.plan2.spi.CollectionReference;
import org.hibernate.loader.plan2.spi.FetchSource;
import org.hibernate.loader.plan2.spi.Join;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.entity.EntityPersister;
@ -71,16 +70,14 @@ public abstract class AbstractCollectionReference implements CollectionReference
);
final Join join = collectionQuerySpace.addIndexEntityJoin(
indexPersister,
loadPlanBuildingContext
indexPersister
);
return new CollectionFetchableIndexEntityGraph( this, join );
}
}
else if ( type.isComponentType() ) {
final Join join = collectionQuerySpace.addIndexCompositeJoin(
(CompositeType) type,
loadPlanBuildingContext
(CompositeType) type
);
return new CollectionFetchableIndexCompositeGraph( this, join );
}
@ -100,14 +97,13 @@ public abstract class AbstractCollectionReference implements CollectionReference
( (EntityType) type ).getAssociatedEntityName()
);
final Join join = collectionQuerySpace.addElementEntityJoin( elementPersister, loadPlanBuildingContext );
final Join join = collectionQuerySpace.addElementEntityJoin( elementPersister );
return new CollectionFetchableElementEntityGraph( this, join );
}
}
else if ( type.isComponentType() ) {
final Join join = collectionQuerySpace.addElementCompositeJoin(
(CompositeType) type,
loadPlanBuildingContext
(CompositeType) type
);
return new CollectionFetchableElementCompositeGraph( this, join );
}

View File

@ -23,19 +23,17 @@
*/
package org.hibernate.loader.plan2.build.internal.spaces;
import org.hibernate.engine.internal.JoinHelper;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.loader.plan2.build.spi.AbstractQuerySpace;
import org.hibernate.loader.plan2.build.spi.LoadPlanBuildingContext;
import org.hibernate.loader.plan2.spi.CollectionQuerySpace;
import org.hibernate.loader.plan2.spi.Join;
import org.hibernate.loader.plan2.spi.JoinDefinedByMetadata;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.collection.CollectionPropertyMapping;
import org.hibernate.persister.collection.CollectionPropertyNames;
import org.hibernate.persister.collection.QueryableCollection;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.PropertyMapping;
import org.hibernate.persister.entity.Queryable;
import org.hibernate.type.CompositeType;
import org.hibernate.type.EntityType;
@ -67,9 +65,7 @@ public class CollectionQuerySpaceImpl extends AbstractQuerySpace implements Coll
return propertyMapping;
}
public JoinImpl addIndexEntityJoin(
final EntityPersister indexPersister,
LoadPlanBuildingContext context) {
public JoinDefinedByMetadata addIndexEntityJoin(final EntityPersister indexPersister) {
final boolean required = canJoinsBeRequired();
final String entityQuerySpaceUid = getQuerySpaces().generateImplicitUid();
final EntityQuerySpaceImpl entityQuerySpace = new EntityQuerySpaceImpl(
@ -81,22 +77,22 @@ public class CollectionQuerySpaceImpl extends AbstractQuerySpace implements Coll
);
getQuerySpaces().registerQuerySpace( entityQuerySpace );
final JoinImpl join = new JoinImpl(
final JoinDefinedByMetadata join = JoinHelper.INSTANCE.createEntityJoin(
this,
// collection persister maps its index (through its PropertyMapping contract) as non-prefixed
CollectionPropertyNames.COLLECTION_INDICES,
entityQuerySpace,
Helper.INSTANCE.determineRhsColumnNames( (EntityType) persister.getIndexType(), sessionFactory() ),
persister.getIndexType(),
required
canJoinsBeRequired(),
(EntityType) persister.getIndexType(),
sessionFactory()
);
internalGetJoins().add( join );
return join;
}
public JoinImpl addIndexCompositeJoin(
CompositeType compositeType,
LoadPlanBuildingContext context) {
public JoinDefinedByMetadata addIndexCompositeJoin(CompositeType compositeType) {
final String compositeQuerySpaceUid = getQuerySpaces().generateImplicitUid();
final CompositeQuerySpaceImpl compositeQuerySpace = new CompositeQuerySpaceImpl(
new CompositePropertyMapping(
@ -111,22 +107,19 @@ public class CollectionQuerySpaceImpl extends AbstractQuerySpace implements Coll
);
getQuerySpaces().registerQuerySpace( compositeQuerySpace );
final JoinImpl join = new JoinImpl(
final JoinDefinedByMetadata join = JoinHelper.INSTANCE.createCompositeJoin(
this,
CollectionPropertyNames.COLLECTION_INDICES,
compositeQuerySpace,
( (QueryableCollection) persister ).getIndexColumnNames(),
persister.getIndexType(),
canJoinsBeRequired()
canJoinsBeRequired(),
compositeType
);
internalGetJoins().add( join );
return join;
}
public JoinImpl addElementEntityJoin(
final EntityPersister elementPersister,
LoadPlanBuildingContext context) {
public JoinDefinedByMetadata addElementEntityJoin(final EntityPersister elementPersister) {
final String entityQuerySpaceUid = getQuerySpaces().generateImplicitUid();
final EntityQuerySpaceImpl entityQuerySpace = new EntityQuerySpaceImpl(
elementPersister,
@ -135,25 +128,24 @@ public class CollectionQuerySpaceImpl extends AbstractQuerySpace implements Coll
canJoinsBeRequired(),
sessionFactory()
);
( (QuerySpacesImpl) context.getQuerySpaces() ).registerQuerySpace( entityQuerySpace );
getQuerySpaces().registerQuerySpace( entityQuerySpace );
final JoinImpl join = new JoinImpl(
final JoinDefinedByMetadata join = JoinHelper.INSTANCE.createEntityJoin(
this,
// collection persister maps its elements (through its PropertyMapping contract) as non-prefixed
CollectionPropertyNames.COLLECTION_ELEMENTS,
entityQuerySpace,
Helper.INSTANCE.determineRhsColumnNames( (EntityType) persister.getElementType(), sessionFactory() ),
persister.getElementType(),
canJoinsBeRequired()
canJoinsBeRequired(),
(EntityType) persister.getElementType(),
sessionFactory()
);
internalGetJoins().add( join );
return join;
}
public Join addElementCompositeJoin(
CompositeType compositeType,
LoadPlanBuildingContext context) {
public JoinDefinedByMetadata addElementCompositeJoin(
CompositeType compositeType) {
final String compositeQuerySpaceUid = getQuerySpaces().generateImplicitUid();
final CompositeQuerySpaceImpl compositeQuerySpace = new CompositeQuerySpaceImpl(
@ -167,16 +159,14 @@ public class CollectionQuerySpaceImpl extends AbstractQuerySpace implements Coll
canJoinsBeRequired(),
sessionFactory()
);
( (QuerySpacesImpl) context.getQuerySpaces() ).registerQuerySpace( compositeQuerySpace );
final JoinImpl join = new JoinImpl(
getQuerySpaces().registerQuerySpace( compositeQuerySpace );
final JoinDefinedByMetadata join = JoinHelper.INSTANCE.createCompositeJoin(
this,
// collection persister maps its elements (through its PropertyMapping contract) as non-prefixed
CollectionPropertyNames.COLLECTION_ELEMENTS,
compositeQuerySpace,
( (QueryableCollection) persister ).getElementColumnNames(),
compositeType,
canJoinsBeRequired()
canJoinsBeRequired(),
compositeType
);
internalGetJoins().add( join );

View File

@ -26,13 +26,13 @@ package org.hibernate.loader.plan2.build.internal.spaces;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.loader.plan2.build.spi.AbstractQuerySpace;
import org.hibernate.loader.plan2.build.spi.ExpandingCompositeQuerySpace;
import org.hibernate.loader.plan2.spi.JoinDefinedByMetadata;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.PropertyMapping;
import org.hibernate.persister.entity.Queryable;
import org.hibernate.persister.walking.spi.AttributeDefinition;
import org.hibernate.persister.walking.spi.CompositionDefinition;
import org.hibernate.type.AssociationType;
import org.hibernate.type.CollectionType;
import org.hibernate.type.EntityType;
@ -73,8 +73,7 @@ public class CompositeQuerySpaceImpl extends AbstractQuerySpace implements Expan
}
@Override
public JoinImpl addCompositeJoin(CompositionDefinition compositionDefinition, String querySpaceUid) {
final String propertyPath = compositionDefinition.getName();
public JoinDefinedByMetadata addCompositeJoin(CompositionDefinition compositionDefinition, String querySpaceUid) {
final boolean required = canJoinsBeRequired() && !compositionDefinition.isNullable();
final CompositeQuerySpaceImpl rhs = new CompositeQuerySpaceImpl(
@ -90,13 +89,12 @@ public class CompositeQuerySpaceImpl extends AbstractQuerySpace implements Expan
);
getQuerySpaces().registerQuerySpace( rhs );
final JoinImpl join = new JoinImpl(
final JoinDefinedByMetadata join = JoinHelper.INSTANCE.createCompositeJoin(
this,
propertyPath,
compositionDefinition.getName(),
rhs,
getPropertyMapping().toColumns( compositionDefinition.getName() ),
compositionDefinition.getType(),
required
required,
compositionDefinition.getType()
);
internalGetJoins().add( join );
@ -104,7 +102,7 @@ public class CompositeQuerySpaceImpl extends AbstractQuerySpace implements Expan
}
@Override
public JoinImpl addEntityJoin(
public JoinDefinedByMetadata addEntityJoin(
AttributeDefinition attributeDefinition,
EntityPersister persister,
String querySpaceUid,
@ -122,22 +120,22 @@ public class CompositeQuerySpaceImpl extends AbstractQuerySpace implements Expan
);
getQuerySpaces().registerQuerySpace( rhs );
final String propertyPath = attributeDefinition.getName();
final JoinImpl join = new JoinImpl(
final JoinDefinedByMetadata join = JoinHelper.INSTANCE.createEntityJoin(
this,
propertyPath,
attributeDefinition.getName(),
rhs,
Helper.INSTANCE.determineRhsColumnNames( (EntityType) attributeDefinition.getType(), sessionFactory() ),
attributeDefinition.getType(),
required
required,
(EntityType) attributeDefinition.getType(),
sessionFactory()
);
internalGetJoins().add( join );
return join;
}
@Override
public JoinImpl addCollectionJoin(
public JoinDefinedByMetadata addCollectionJoin(
AttributeDefinition attributeDefinition,
CollectionPersister collectionPersister,
String querySpaceUid) {
@ -152,14 +150,14 @@ public class CompositeQuerySpaceImpl extends AbstractQuerySpace implements Expan
);
getQuerySpaces().registerQuerySpace( rhs );
final JoinImpl join = new JoinImpl(
final JoinDefinedByMetadata join = JoinHelper.INSTANCE.createCollectionJoin(
this,
attributeDefinition.getName(),
rhs,
( (CollectionType) attributeDefinition.getType() ).getAssociatedJoinable( sessionFactory() ).getKeyColumnNames(),
attributeDefinition.getType(),
required
rhs, required,
(CollectionType) attributeDefinition.getType(),
sessionFactory()
);
internalGetJoins().add( join );
return join;

View File

@ -27,14 +27,13 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.loader.plan2.build.spi.AbstractQuerySpace;
import org.hibernate.loader.plan2.build.spi.ExpandingEntityQuerySpace;
import org.hibernate.loader.plan2.spi.Join;
import org.hibernate.loader.plan2.spi.JoinDefinedByMetadata;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.Loadable;
import org.hibernate.persister.entity.PropertyMapping;
import org.hibernate.persister.entity.Queryable;
import org.hibernate.persister.walking.spi.AttributeDefinition;
import org.hibernate.persister.walking.spi.CompositionDefinition;
import org.hibernate.type.AssociationType;
import org.hibernate.type.CollectionType;
import org.hibernate.type.CompositeType;
import org.hibernate.type.EntityType;
@ -73,7 +72,7 @@ public class EntityQuerySpaceImpl extends AbstractQuerySpace implements Expandin
}
@Override
public JoinImpl addCompositeJoin(CompositionDefinition compositionDefinition, String querySpaceUid) {
public JoinDefinedByMetadata addCompositeJoin(CompositionDefinition compositionDefinition, String querySpaceUid) {
final boolean required = canJoinsBeRequired() && !compositionDefinition.isNullable();
final CompositeQuerySpaceImpl rhs = new CompositeQuerySpaceImpl(
@ -89,20 +88,19 @@ public class EntityQuerySpaceImpl extends AbstractQuerySpace implements Expandin
);
getQuerySpaces().registerQuerySpace( rhs );
final JoinImpl join = new JoinImpl(
final JoinDefinedByMetadata join = JoinHelper.INSTANCE.createCompositeJoin(
this,
compositionDefinition.getName(),
rhs,
( (PropertyMapping) persister ).toColumns( compositionDefinition.getName() ),
compositionDefinition.getType(),
required
required,
compositionDefinition.getType()
);
internalGetJoins().add( join );
return join;
}
public JoinImpl addEntityJoin(
public JoinDefinedByMetadata addEntityJoin(
AttributeDefinition attribute,
EntityPersister persister,
String querySpaceUid,
@ -120,24 +118,22 @@ public class EntityQuerySpaceImpl extends AbstractQuerySpace implements Expandin
);
getQuerySpaces().registerQuerySpace( rhs );
final JoinImpl join = new JoinImpl(
final JoinDefinedByMetadata join = JoinHelper.INSTANCE.createEntityJoin(
this,
attribute.getName(),
rhs,
Helper.INSTANCE.determineRhsColumnNames(
(EntityType) attribute.getType(),
sessionFactory()
),
attribute.getType(),
required
required,
(EntityType) attribute.getType(),
sessionFactory()
);
internalGetJoins().add( join );
return join;
}
@Override
public JoinImpl addCollectionJoin(
public JoinDefinedByMetadata addCollectionJoin(
AttributeDefinition attributeDefinition,
CollectionPersister collectionPersister,
String querySpaceUid) {
@ -151,14 +147,13 @@ public class EntityQuerySpaceImpl extends AbstractQuerySpace implements Expandin
sessionFactory()
);
getQuerySpaces().registerQuerySpace( rhs );
final JoinImpl join = new JoinImpl(
final JoinDefinedByMetadata join = JoinHelper.INSTANCE.createCollectionJoin(
this,
attributeDefinition.getName(),
rhs,
( (CollectionType) attributeDefinition.getType() ).getAssociatedJoinable( sessionFactory() ).getKeyColumnNames(),
attributeDefinition.getType(),
required
required,
(CollectionType) attributeDefinition.getType(),
sessionFactory()
);
internalGetJoins().add( join );
@ -166,7 +161,7 @@ public class EntityQuerySpaceImpl extends AbstractQuerySpace implements Expandin
}
@Override
public Join makeCompositeIdentifierJoin() {
public JoinDefinedByMetadata makeCompositeIdentifierJoin() {
final String compositeQuerySpaceUid = getUid() + "-id";
final CompositeQuerySpaceImpl rhs = new CompositeQuerySpaceImpl(
this,
@ -180,13 +175,12 @@ public class EntityQuerySpaceImpl extends AbstractQuerySpace implements Expandin
);
getQuerySpaces().registerQuerySpace( rhs );
final JoinImpl join = new JoinImpl(
final JoinDefinedByMetadata join = JoinHelper.INSTANCE.createCompositeJoin(
this,
EntityPersister.ENTITY_ID,
rhs,
( (Loadable) persister ).getIdentifierColumnNames(),
null,
canJoinsBeRequired()
canJoinsBeRequired(),
(CompositeType) persister.getIdentifierType()
);
internalGetJoins().add( join );

View File

@ -1,49 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2013, 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.loader.plan2.build.internal.spaces;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.persister.entity.Joinable;
import org.hibernate.persister.entity.PropertyMapping;
import org.hibernate.type.EntityType;
/**
* @author Steve Ebersole
*/
public class Helper {
/**
* Singleton access
*/
public static final Helper INSTANCE = new Helper();
private Helper() {
}
public String[] determineRhsColumnNames(EntityType entityType, SessionFactoryImplementor sessionFactory) {
final Joinable persister = entityType.getAssociatedJoinable( sessionFactory );
return entityType.getRHSUniqueKeyPropertyName() == null ?
persister.getKeyColumnNames() :
( (PropertyMapping) persister ).toColumns( entityType.getRHSUniqueKeyPropertyName() );
}
}

View File

@ -0,0 +1,107 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2013, 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.loader.plan2.build.internal.spaces;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.loader.plan2.spi.CollectionQuerySpace;
import org.hibernate.loader.plan2.spi.CompositeQuerySpace;
import org.hibernate.loader.plan2.spi.EntityQuerySpace;
import org.hibernate.loader.plan2.spi.JoinDefinedByMetadata;
import org.hibernate.loader.plan2.spi.QuerySpace;
import org.hibernate.persister.entity.Joinable;
import org.hibernate.persister.entity.PropertyMapping;
import org.hibernate.type.CollectionType;
import org.hibernate.type.CompositeType;
import org.hibernate.type.EntityType;
/**
* @author Steve Ebersole
* @author Gail Badner
*/
public class JoinHelper {
/**
* Singleton access
*/
public static final JoinHelper INSTANCE = new JoinHelper();
private JoinHelper() {
}
public JoinDefinedByMetadata createEntityJoin(
QuerySpace leftHandSide,
String lhsPropertyName,
EntityQuerySpace rightHandSide,
boolean rightHandSideRequired,
EntityType joinedPropertyType,
SessionFactoryImplementor sessionFactory) {
return new JoinImpl(
leftHandSide,
lhsPropertyName,
rightHandSide,
determineRhsColumnNames( joinedPropertyType, sessionFactory ),
joinedPropertyType,
rightHandSideRequired
);
}
public JoinDefinedByMetadata createCollectionJoin(
QuerySpace leftHandSide,
String lhsPropertyName,
CollectionQuerySpace rightHandSide,
boolean rightHandSideRequired,
CollectionType joinedPropertyType,
SessionFactoryImplementor sessionFactory) {
return new JoinImpl(
leftHandSide,
lhsPropertyName,
rightHandSide,
joinedPropertyType.getAssociatedJoinable( sessionFactory ).getKeyColumnNames(),
joinedPropertyType,
rightHandSideRequired
);
}
public JoinDefinedByMetadata createCompositeJoin(
QuerySpace leftHandSide,
String lhsPropertyName,
CompositeQuerySpace rightHandSide,
boolean rightHandSideRequired,
CompositeType joinedPropertyType) {
return new JoinImpl(
leftHandSide,
lhsPropertyName,
rightHandSide,
null,
joinedPropertyType,
rightHandSideRequired
);
}
private static String[] determineRhsColumnNames(EntityType entityType, SessionFactoryImplementor sessionFactory) {
final Joinable persister = entityType.getAssociatedJoinable( sessionFactory );
return entityType.getRHSUniqueKeyPropertyName() == null ?
persister.getKeyColumnNames() :
( (PropertyMapping) persister ).toColumns( entityType.getRHSUniqueKeyPropertyName() );
}
}

View File

@ -46,14 +46,14 @@ public class JoinImpl implements JoinDefinedByMetadata {
String lhsPropertyName,
QuerySpace rightHandSide,
String[] rhsColumnNames,
Type propertyType,
Type joinedPropertyType,
boolean rightHandSideRequired) {
this.leftHandSide = leftHandSide;
this.lhsPropertyName = lhsPropertyName;
this.rightHandSide = rightHandSide;
this.rhsColumnNames = rhsColumnNames;
this.rightHandSideRequired = rightHandSideRequired;
this.joinedPropertyType = propertyType;
this.joinedPropertyType = joinedPropertyType;
if ( StringHelper.isEmpty( lhsPropertyName ) ) {
throw new IllegalArgumentException( "Incoming 'lhsPropertyName' parameter was empty" );
}

View File

@ -25,10 +25,11 @@ package org.hibernate.loader.plan2.build.spi;
import org.hibernate.loader.plan2.spi.EntityQuerySpace;
import org.hibernate.loader.plan2.spi.Join;
import org.hibernate.loader.plan2.spi.JoinDefinedByMetadata;
/**
* @author Steve Ebersole
*/
public interface ExpandingEntityQuerySpace extends EntityQuerySpace, ExpandingQuerySpace {
public Join makeCompositeIdentifierJoin();
public JoinDefinedByMetadata makeCompositeIdentifierJoin();
}

View File

@ -35,7 +35,9 @@ import org.hibernate.persister.walking.spi.CompositionDefinition;
*/
public interface ExpandingQuerySpace extends QuerySpace {
public JoinDefinedByMetadata addCompositeJoin(CompositionDefinition compositionDefinition, String querySpaceUid);
public JoinDefinedByMetadata addCompositeJoin(
CompositionDefinition compositionDefinition,
String querySpaceUid);
public JoinDefinedByMetadata addEntityJoin(
AttributeDefinition attributeDefinition,

View File

@ -10,6 +10,7 @@ public class Generation {
private String age;
private String culture;
private SubGeneration subGeneration;
public String getAge() {
return age;
@ -23,4 +24,30 @@ public class Generation {
public void setCulture(String culture) {
this.culture = culture;
}
public SubGeneration getSubGeneration() {
return subGeneration;
}
public void setSubGeneration(SubGeneration subGeneration) {
this.subGeneration = subGeneration;
}
@Embeddable
public static class SubGeneration {
private String description;
public SubGeneration() {
}
public SubGeneration(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
}

View File

@ -42,6 +42,7 @@ public class MapKeyTest extends BaseCoreFunctionalTestCase {
Generation c = new Generation();
c.setAge( "a" );
c.setCulture( "b" );
c.setSubGeneration( new Generation.SubGeneration( "description" ) );
GenerationGroup r = new GenerationGroup();
r.setGeneration( c );
s.persist( r );
@ -52,7 +53,9 @@ public class MapKeyTest extends BaseCoreFunctionalTestCase {
s.clear();
m = (GenerationUser) s.get( GenerationUser.class, m.getId() );
assertEquals( "a", m.getRef().keySet().iterator().next().getAge() );
Generation cRead = m.getRef().keySet().iterator().next();
assertEquals( "a",cRead.getAge() );
assertEquals( "description", cRead.getSubGeneration().getDescription() );
tx.rollback();
s.close();
}