HHH-7919 : Miscellaneous bugfixes

This commit is contained in:
Gail Badner 2013-05-24 12:25:28 -07:00
parent 0c199b0374
commit 3b593298f6
20 changed files with 201 additions and 23 deletions

View File

@ -2009,7 +2009,7 @@ public class Binder {
private void bindBasicCollectionIndex(
final IndexedPluralAttributeBinding attributeBinding,
final BasicPluralAttributeIndexSource attributeSource,
final BasicPluralAttributeIndexSource indexSource,
final String defaultIndexJavaTypeName) {
final BasicPluralAttributeIndexBinding indexBinding =
(BasicPluralAttributeIndexBinding) attributeBinding.getPluralAttributeIndexBinding();
@ -2017,9 +2017,10 @@ public class Binder {
indexBinding.setRelationalValueBindings(
bindValues(
attributeBinding.getContainer(),
attributeSource,
indexSource,
attributeBinding.getAttribute(),
attributeBinding.getPluralAttributeKeyBinding().getCollectionTable(),
indexSource.getDefaultNamingStrategies(),
attributeBinding.getPluralAttributeElementBinding()
.getNature() != PluralAttributeElementBinding.Nature.ONE_TO_MANY
)
@ -2028,7 +2029,7 @@ public class Binder {
typeHelper.bindHibernateTypeDescriptor(
indexBinding.getHibernateTypeDescriptor(),
attributeSource.explicitHibernateTypeSource(),
indexSource.explicitHibernateTypeSource(),
defaultIndexJavaTypeName
);
typeHelper.bindJdbcDataType(
@ -2908,13 +2909,25 @@ public class Binder {
}
else {
final String name = defaultNamingStrategyList.get( 0 ).defaultName();
for ( final RelationalValueSource valueSource : valueSourceContainer.relationalValueSources() ) {
for ( int i = 0 ; i < valueSourceContainer.relationalValueSources().size(); i++ ) {
final RelationalValueSource valueSource = valueSourceContainer.relationalValueSources().get( i );
final TableSpecification table =
valueSource.getContainingTableName() == null
? defaultTable
: attributeBindingContainer.seekEntityBinding()
.locateTable( valueSource.getContainingTableName() );
final String name;
if ( ColumnSource.class.isInstance( valueSource ) ) {
ColumnSource columnSource = (ColumnSource) valueSource;
// Use default if a name is not provided.
name = StringHelper.isNotEmpty( columnSource.getName() ) ?
columnSource.getName() :
defaultNamingStrategyList.get( i ).defaultName();
}
else {
// name should be null for derived values.
name = null;
}
if ( valueSource.getNature() == RelationalValueSource.Nature.COLUMN ) {
final ColumnSource columnSource = (ColumnSource) valueSource;
Column column = createColumn(

View File

@ -6,6 +6,7 @@ import java.util.List;
import org.hibernate.metamodel.internal.source.annotations.attribute.AssociationAttribute;
import org.hibernate.metamodel.internal.source.annotations.attribute.Column;
import org.hibernate.metamodel.internal.source.annotations.attribute.MappedAttribute;
import org.hibernate.metamodel.internal.source.annotations.attribute.PluralAssociationAttribute;
import org.hibernate.metamodel.spi.source.BasicPluralAttributeElementSource;
import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource;
import org.hibernate.metamodel.spi.source.RelationalValueSource;
@ -14,9 +15,9 @@ import org.hibernate.metamodel.spi.source.RelationalValueSource;
* @author Hardy Ferentschik
*/
public class BasicPluralAttributeElementSourceImpl implements BasicPluralAttributeElementSource {
private final AssociationAttribute associationAttribute;
private final PluralAssociationAttribute associationAttribute;
public BasicPluralAttributeElementSourceImpl(AssociationAttribute associationAttribute) {
public BasicPluralAttributeElementSourceImpl(PluralAssociationAttribute associationAttribute) {
this.associationAttribute = associationAttribute;
}

View File

@ -24,11 +24,13 @@
package org.hibernate.metamodel.internal.source.annotations;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.jboss.jandex.AnnotationInstance;
import org.hibernate.metamodel.internal.Binder;
import org.hibernate.metamodel.internal.source.annotations.attribute.Column;
import org.hibernate.metamodel.internal.source.annotations.attribute.PluralAssociationAttribute;
import org.hibernate.metamodel.internal.source.annotations.util.HibernateDotNames;
@ -46,7 +48,11 @@ public class BasicPluralAttributeIndexSourceImpl implements BasicPluralAttribute
private final PluralAssociationAttribute attribute;
private final IndexedPluralAttributeSourceImpl indexedPluralAttributeSource;
private final List<RelationalValueSource> relationalValueSources = new ArrayList<RelationalValueSource>( 1 );
public BasicPluralAttributeIndexSourceImpl(IndexedPluralAttributeSourceImpl indexedPluralAttributeSource, PluralAssociationAttribute attribute) {
private final Binder.DefaultNamingStrategy defaultNamingStrategy;
public BasicPluralAttributeIndexSourceImpl(
IndexedPluralAttributeSourceImpl indexedPluralAttributeSource,
PluralAssociationAttribute attribute,
Binder.DefaultNamingStrategy defaultNamingStrategy) {
this.attribute = attribute;
this.indexedPluralAttributeSource = indexedPluralAttributeSource;
AnnotationInstance columnAnnotation = JandexHelper.getSingleAnnotation(
@ -59,9 +65,15 @@ public class BasicPluralAttributeIndexSourceImpl implements BasicPluralAttribute
JPADotNames.ORDER_COLUMN
);
}
if ( columnAnnotation == null) {
columnAnnotation = JandexHelper.getSingleAnnotation(
attribute.annotations(),
JPADotNames.MAP_KEY_COLUMN
);
}
Column indexColumn = new Column( columnAnnotation );
relationalValueSources.add( new ColumnValuesSourceImpl( indexColumn ) );
this.defaultNamingStrategy = defaultNamingStrategy;
}
@Override
@ -69,6 +81,11 @@ public class BasicPluralAttributeIndexSourceImpl implements BasicPluralAttribute
return PluralAttributeIndexBinding.Nature.BASIC;
}
@Override
public List<Binder.DefaultNamingStrategy> getDefaultNamingStrategies() {
return Collections.singletonList( defaultNamingStrategy );
}
@Override
public ExplicitHibernateTypeSource explicitHibernateTypeSource() {
return new ExplicitHibernateTypeSource() {

View File

@ -25,9 +25,18 @@ package org.hibernate.metamodel.internal.source.annotations;
import java.util.EnumSet;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.JandexAntTask;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.cfg.NotYetImplementedException;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.metamodel.internal.Binder;
import org.hibernate.metamodel.internal.source.annotations.attribute.MappedAttribute;
import org.hibernate.metamodel.internal.source.annotations.attribute.PluralAssociationAttribute;
import org.hibernate.metamodel.internal.source.annotations.entity.ConfiguredClass;
import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames;
import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper;
import org.hibernate.metamodel.spi.source.IndexedPluralAttributeSource;
import org.hibernate.metamodel.spi.source.MappingException;
import org.hibernate.metamodel.spi.source.PluralAttributeIndexSource;
@ -44,7 +53,8 @@ public class IndexedPluralAttributeSourceImpl extends PluralAttributeSourceImpl
MappedAttribute.Nature.ELEMENT_COLLECTION_BASIC,
MappedAttribute.Nature.ELEMENT_COLLECTION_EMBEDDABLE);
public IndexedPluralAttributeSourceImpl(PluralAssociationAttribute attribute,
public IndexedPluralAttributeSourceImpl(
final PluralAssociationAttribute attribute,
ConfiguredClass entityClass ) {
super( attribute, entityClass );
if ( !VALID_NATURES.contains( attribute.getNature() ) ) {
@ -53,12 +63,70 @@ public class IndexedPluralAttributeSourceImpl extends PluralAttributeSourceImpl
attribute.getContext().getOrigin()
);
}
// TODO: add checks for inconsistent annotations
if ( attribute.isSequentiallyIndexed() ) {
indexSource = new SequentialPluralAttributeIndexSourceImpl( this, attribute );
final Binder.DefaultNamingStrategy defaultNamingStrategy = new Binder.DefaultNamingStrategy() {
@Override
public String defaultName() {
return attribute.getName() + "_ORDER";
}
};
indexSource = new SequentialPluralAttributeIndexSourceImpl( this, attribute, defaultNamingStrategy );
}
else if ( attribute.annotations().containsKey( JPADotNames.MAP_KEY ) ) {
// basic
throw new NotYetImplementedException( "@MapKey is not supported yet." );
}
else if ( attribute.annotations().containsKey( JPADotNames.MAP_KEY_COLUMN ) ) {
final Binder.DefaultNamingStrategy defaultNamingStrategy = new Binder.DefaultNamingStrategy() {
@Override
public String defaultName() {
return attribute.getName() + "_KEY";
}
};
indexSource = new BasicPluralAttributeIndexSourceImpl( this, attribute, defaultNamingStrategy );
}
else if ( attribute.annotations().containsKey( JPADotNames.MAP_KEY_ENUMERATED ) ) {
// basic
throw new NotYetImplementedException( "@MapKeyEnumerated is not supported yet." );
}
else if ( attribute.annotations().containsKey( JPADotNames.MAP_KEY_TEMPORAL ) ) {
// basic
throw new NotYetImplementedException( "@MapKeyTemporal is not supported yet." );
}
else if ( attribute.annotations().containsKey( JPADotNames.MAP_KEY_CLASS ) ) {
// can be anything
throw new NotYetImplementedException( "@MapKeyClass is not supported yet." );
}
else if ( attribute.annotations().containsKey( JPADotNames.MAP_KEY_JOIN_COLUMN ) ) {
// association
throw new NotYetImplementedException( "@MapKeyJoinColumn is not supported yet." );
}
else if ( attribute.annotations().containsKey( JPADotNames.MAP_KEY_JOIN_COLUMNS ) ) {
// association
throw new NotYetImplementedException( "@MapKeyJoinColumns is not supported yet." );
}
else if ( String.class.equals( attribute.getIndexType() ) || attribute.getIndexType().isPrimitive() ) {
final Binder.DefaultNamingStrategy defaultNamingStrategy = new Binder.DefaultNamingStrategy() {
@Override
public String defaultName() {
return attribute.getName() + "_KEY";
}
};
indexSource = new BasicPluralAttributeIndexSourceImpl( this, attribute, defaultNamingStrategy );
}
else {
// for now assume the index is basic type
indexSource = new BasicPluralAttributeIndexSourceImpl( this, attribute );
// either @Embeddable or entity type.
// composite:
// index is @Embeddable
// @MapKeyClass is not basic, not entity type
// association:
// MapKeyJoinColumn, MapKeyJoinColumns are present
// If the primary key of the referenced entity is not a simple primary key, must have MapKeyJoinColumns.
//indexSource = new BasicPluralAttributeIndexSourceImpl( this, attribute );
throw new NotYetImplementedException( "Embeddable and entity keys are not supported yet." );
}
}

View File

@ -25,6 +25,7 @@ package org.hibernate.metamodel.internal.source.annotations;
import org.jboss.jandex.AnnotationInstance;
import org.hibernate.metamodel.internal.Binder;
import org.hibernate.metamodel.internal.source.annotations.attribute.PluralAssociationAttribute;
import org.hibernate.metamodel.internal.source.annotations.util.HibernateDotNames;
import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames;
@ -38,8 +39,11 @@ public class SequentialPluralAttributeIndexSourceImpl
extends BasicPluralAttributeIndexSourceImpl
implements SequentialPluralAttributeIndexSource {
private final int base;
public SequentialPluralAttributeIndexSourceImpl(IndexedPluralAttributeSourceImpl indexedPluralAttributeSource, PluralAssociationAttribute attribute) {
super( indexedPluralAttributeSource, attribute );
public SequentialPluralAttributeIndexSourceImpl(
IndexedPluralAttributeSourceImpl indexedPluralAttributeSource,
PluralAssociationAttribute attribute,
Binder.DefaultNamingStrategy defaultNamingStrategy) {
super( indexedPluralAttributeSource, attribute, defaultNamingStrategy );
AnnotationInstance columnAnnotation = JandexHelper.getSingleAnnotation(
attribute.annotations(),
HibernateDotNames.INDEX_COLUMN

View File

@ -74,6 +74,7 @@ public class AssociationAttribute extends MappedAttribute {
private final boolean ignoreNotFound;
private final String referencedEntityType;
private final Class<?> referencedAttributeType;
private final String mappedBy;
private final Set<CascadeType> cascadeTypes;
private final Set<org.hibernate.annotations.CascadeType> hibernateCascadeTypes;
@ -146,6 +147,7 @@ public class AssociationAttribute extends MappedAttribute {
// using jandex we don't really care which exact type of annotation we are dealing with
this.referencedEntityType = determineReferencedEntityType( associationAnnotation, referencedAttributeType );
this.referencedAttributeType = referencedAttributeType;
this.mappedBy = determineMappedByAttributeName( associationAnnotation );
this.isOptional = determineOptionality( associationAnnotation );
this.isLazy = determineIsLazy( associationAnnotation );
@ -174,6 +176,10 @@ public class AssociationAttribute extends MappedAttribute {
return referencedEntityType;
}
public Class<?> getReferencedAttributeType() {
return referencedAttributeType;
}
public String getMappedBy() {
return mappedBy;
}

View File

@ -66,6 +66,7 @@ public class Column {
|| JPADotNames.ORDER_COLUMN.equals( name )
|| HibernateDotNames.INDEX_COLUMN.equals( name )
|| JPADotNames.PRIMARY_KEY_JOIN_COLUMN.equals( name )
|| JPADotNames.MAP_KEY_COLUMN.equals( name )
) ) {
throw new AssertionFailure( "A @Column or @JoinColumn annotation needs to be passed to the constructor" );

View File

@ -43,6 +43,12 @@ import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.annotations.OnDeleteAction;
import org.hibernate.annotations.SortType;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.metamodel.internal.source.annotations.attribute.type.AttributeTypeResolver;
import org.hibernate.metamodel.internal.source.annotations.attribute.type.AttributeTypeResolverImpl;
import org.hibernate.metamodel.internal.source.annotations.attribute.type.CompositeAttributeTypeResolver;
import org.hibernate.metamodel.internal.source.annotations.attribute.type.EnumeratedTypeResolver;
import org.hibernate.metamodel.internal.source.annotations.attribute.type.LobTypeResolver;
import org.hibernate.metamodel.internal.source.annotations.attribute.type.TemporalTypeResolver;
import org.hibernate.metamodel.internal.source.annotations.entity.EntityBindingContext;
import org.hibernate.metamodel.internal.source.annotations.util.AnnotationParserHelper;
import org.hibernate.metamodel.internal.source.annotations.util.HibernateDotNames;
@ -60,6 +66,7 @@ import org.hibernate.metamodel.spi.source.PluralAttributeSource;
* @author Strong Liu
*/
public class PluralAssociationAttribute extends AssociationAttribute {
private final Class<?> indexType;
private final String whereClause;
private final String orderBy;
private final boolean sorted;
@ -93,6 +100,7 @@ public class PluralAssociationAttribute extends AssociationAttribute {
ClassInfo entityClassInfo,
String name,
Class<?> attributeType,
Class<?> indexType,
Class<?> referencedAttributeType,
Nature attributeNature,
String accessType,
@ -102,6 +110,7 @@ public class PluralAssociationAttribute extends AssociationAttribute {
entityClassInfo,
name,
attributeType,
indexType,
referencedAttributeType,
attributeNature,
accessType,
@ -114,6 +123,10 @@ public class PluralAssociationAttribute extends AssociationAttribute {
return pluralAttributeNature;
}
public Class<?> getIndexType() {
return indexType;
}
public String getWhereClause() {
return whereClause;
}
@ -185,6 +198,7 @@ public class PluralAssociationAttribute extends AssociationAttribute {
final ClassInfo entityClassInfo,
final String name,
final Class<?> attributeType,
final Class<?> indexType,
final Class<?> referencedAttributeType,
final Nature associationType,
final String accessType,
@ -192,6 +206,7 @@ public class PluralAssociationAttribute extends AssociationAttribute {
final EntityBindingContext context) {
super( entityClassInfo, name, attributeType, referencedAttributeType, associationType, accessType, annotations, context );
this.entityClassInfo = entityClassInfo;
this.indexType = indexType;
this.whereClause = determineWereClause();
this.orderBy = determineOrderBy();
@ -525,6 +540,19 @@ public class PluralAssociationAttribute extends AssociationAttribute {
public boolean isMutable() {
return mutable;
}
/*
@Override
public AttributeTypeResolver getHibernateTypeResolver() {
CompositeAttributeTypeResolver resolver = new CompositeAttributeTypeResolver( this );
resolver.addHibernateTypeResolver( new AttributeTypeResolverImpl( this ) );
// TODO: make it work for temporal elements
//resolver.addHibernateTypeResolver( new TemporalTypeResolver( this ) );
resolver.addHibernateTypeResolver( new LobTypeResolver( this ) );
resolver.addHibernateTypeResolver( new EnumeratedTypeResolver( this ) );
return resolver;
}
*/
}

View File

@ -33,9 +33,11 @@ import org.jboss.jandex.AnnotationInstance;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.metamodel.internal.source.annotations.attribute.MappedAttribute;
import org.hibernate.metamodel.internal.source.annotations.attribute.PluralAssociationAttribute;
import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames;
import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper;
import org.hibernate.type.EnumType;
import org.hibernate.usertype.DynamicParameterizedType;
/**
* @author Strong Liu
@ -44,11 +46,20 @@ import org.hibernate.type.EnumType;
public class EnumeratedTypeResolver extends AbstractAttributeTypeResolver {
private final boolean isMapKey;
private final boolean isEnum;
// private final String attributeType;
public EnumeratedTypeResolver(MappedAttribute mappedAttribute) {
super( mappedAttribute );
isEnum = mappedAttribute.getAttributeType().isEnum();
isMapKey = false;//todo
// attributeType = mappedAttribute.getAttributeType().getName();
}
public EnumeratedTypeResolver(PluralAssociationAttribute pluralAssociationAttribute) {
super( pluralAssociationAttribute );
isEnum = pluralAssociationAttribute.getReferencedAttributeType().isEnum();
isMapKey = false;//todo
// attributeType = pluralAssociationAttribute.getReferencedAttributeType().getName();
}
@Override
@ -98,6 +109,7 @@ public class EnumeratedTypeResolver extends AbstractAttributeTypeResolver {
else {
typeParameters.put( EnumType.TYPE, String.valueOf( Types.INTEGER ) );
}
// typeParameters.put( DynamicParameterizedType.RETURNED_CLASS, attributeType );
return typeParameters;
}
}

View File

@ -451,7 +451,10 @@ public class ConfiguredClass {
);
Class<?> attributeType = resolvedMember.getType().getErasedType();
Class<?> referencedCollectionType = resolveCollectionValuedReferenceType( resolvedMember, annotations );
Class<?> indexType = null;
if(Map.class.isAssignableFrom( attributeType )){
indexType = resolvedMember.getType().getTypeParameters().get( 0 ).getErasedType();
}
MappedAttribute.Nature attributeNature = determineAttributeNature(
annotations, attributeType, referencedCollectionType );
String accessTypeString = accessType.toString().toLowerCase();
@ -536,6 +539,7 @@ public class ConfiguredClass {
classInfo,
attributeName,
resolvedMember.getType().getErasedType(),
indexType,
referencedCollectionType,
attributeNature,
accessTypeString,

View File

@ -31,6 +31,7 @@ import org.hibernate.jaxb.spi.hbm.JaxbCompositeIndexElement;
import org.hibernate.jaxb.spi.hbm.JaxbCompositeMapKeyElement;
import org.hibernate.jaxb.spi.hbm.JaxbKeyManyToOneElement;
import org.hibernate.jaxb.spi.hbm.JaxbKeyPropertyElement;
import org.hibernate.metamodel.internal.Binder;
import org.hibernate.metamodel.spi.binding.PluralAttributeIndexBinding;
import org.hibernate.metamodel.spi.binding.SingularAttributeBinding;
import org.hibernate.metamodel.spi.source.AttributeSource;
@ -89,6 +90,11 @@ public class CompositePluralAttributeIndexSourceImpl
return PluralAttributeIndexBinding.Nature.AGGREGATE;
}
@Override
public List<Binder.DefaultNamingStrategy> getDefaultNamingStrategies() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
@Override
public String getClassName() {
return className;

View File

@ -29,6 +29,7 @@ import java.util.Map;
import org.hibernate.jaxb.spi.hbm.JaxbColumnElement;
import org.hibernate.jaxb.spi.hbm.JaxbIndexElement;
import org.hibernate.jaxb.spi.hbm.JaxbMapKeyElement;
import org.hibernate.metamodel.internal.Binder;
import org.hibernate.metamodel.spi.binding.PluralAttributeIndexBinding;
import org.hibernate.metamodel.spi.source.BasicPluralAttributeIndexSource;
import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource;
@ -184,6 +185,11 @@ public class MapKeySourceImpl extends AbstractHbmSourceNode implements BasicPlur
return nature;
}
@Override
public List<Binder.DefaultNamingStrategy> getDefaultNamingStrategies() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
@Override
public ExplicitHibernateTypeSource explicitHibernateTypeSource() {
return typeSource;

View File

@ -31,6 +31,7 @@ import org.hibernate.internal.util.StringHelper;
import org.hibernate.jaxb.spi.hbm.JaxbColumnElement;
import org.hibernate.jaxb.spi.hbm.JaxbIndexElement;
import org.hibernate.jaxb.spi.hbm.JaxbListIndexElement;
import org.hibernate.metamodel.internal.Binder;
import org.hibernate.metamodel.spi.binding.PluralAttributeIndexBinding;
import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource;
import org.hibernate.metamodel.spi.source.RelationalValueSource;
@ -157,6 +158,11 @@ public class SequentialPluralAttributeIndexSourceImpl extends AbstractHbmSourceN
return PluralAttributeIndexBinding.Nature.BASIC;
}
@Override
public List<Binder.DefaultNamingStrategy> getDefaultNamingStrategies() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
@Override
public ExplicitHibernateTypeSource explicitHibernateTypeSource() {
return typeSource;

View File

@ -23,6 +23,9 @@
*/
package org.hibernate.metamodel.spi.source;
import java.util.List;
import org.hibernate.metamodel.internal.Binder;
import org.hibernate.metamodel.spi.binding.PluralAttributeIndexBinding;
/**
@ -30,4 +33,5 @@ import org.hibernate.metamodel.spi.binding.PluralAttributeIndexBinding;
*/
public interface PluralAttributeIndexSource extends RelationalValueSourceContainer {
PluralAttributeIndexBinding.Nature getNature();
List<Binder.DefaultNamingStrategy> getDefaultNamingStrategies();
}

View File

@ -48,6 +48,7 @@ import org.hibernate.metamodel.spi.binding.SingularAttributeBinding;
import org.hibernate.metamodel.spi.relational.Column;
import org.hibernate.metamodel.spi.relational.Identifier;
import org.hibernate.metamodel.spi.relational.Value;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.hibernate.type.BagType;
import org.hibernate.type.CollectionType;

View File

@ -37,7 +37,6 @@ import static org.junit.Assert.assertNotNull;
/**
* @author Emmanuel Bernard
*/
@FailureExpectedWithNewMetamodel
public class ArrayTest extends BaseCoreFunctionalTestCase {
@Test
public void testOneToMany() throws Exception {

View File

@ -52,7 +52,7 @@ import org.junit.Test;
@SuppressWarnings("unchecked")
public class CollectionElementTest extends BaseCoreFunctionalTestCase {
@Test
@FailureExpectedWithNewMetamodel
@FailureExpectedWithNewMetamodel( message = "Map with EnumType value not supported yet.")
public void testSimpleElement() throws Exception {
assertEquals( "BoyFavoriteNumbers", SchemaUtil.getCollection( Boy.class, "favoriteNumbers", metadata() )
.getPluralAttributeKeyBinding().getCollectionTable().getLogicalName().toString() );
@ -103,7 +103,7 @@ public class CollectionElementTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpectedWithNewMetamodel
@FailureExpectedWithNewMetamodel( message = "AttributeOverride for embeddable not working.")
public void testCompositeElement() throws Exception {
Session s = openSession();
s.getTransaction().begin();
@ -160,7 +160,7 @@ public class CollectionElementTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpectedWithNewMetamodel
@FailureExpectedWithNewMetamodel( message = "Collection with EnumType element not supported yet.")
public void testLazyCollectionofElements() throws Exception {
assertEquals( "BoyFavoriteNumbers", SchemaUtil.getCollection( Boy.class, "favoriteNumbers", metadata() )
.getPluralAttributeKeyBinding().getCollectionTable().getLogicalName().toString() );
@ -202,7 +202,7 @@ public class CollectionElementTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpectedWithNewMetamodel
@FailureExpectedWithNewMetamodel( message = "Map with EnumType key not supported yet.")
public void testFetchEagerAndFilter() throws Exception {
Session s = openSession();
Transaction tx = s.beginTransaction();
@ -233,7 +233,6 @@ public class CollectionElementTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpectedWithNewMetamodel
public void testMapKeyType() throws Exception {
Matrix m = new Matrix();
m.getMvalues().put( 1, 1.1f );

View File

@ -26,11 +26,13 @@ package org.hibernate.test.annotations.genericsinheritance;
import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
/**
* @author Emmanuel Bernard
*/
@FailureExpectedWithNewMetamodel( message = "@MapKey is not supported yet." )
public class GenericsInheritanceTest extends BaseCoreFunctionalTestCase {
@Test
public void testMapping() throws Exception {

View File

@ -53,6 +53,7 @@ import org.junit.Test;
*
* @author Emmanuel Bernard
*/
@FailureExpectedWithNewMetamodel( message = "@MapKeyJoinColumns not supported yet." )
public class IndexedCollectionTest extends BaseCoreFunctionalTestCase {
@Test
@FailureExpectedWithNewMetamodel

View File

@ -41,7 +41,7 @@ public class BackrefTest extends BaseCoreFunctionalTestCase {
protected String[] getMappings() {
return new String[] { "unidir/ParentChild.hbm.xml" };
}
@Override
protected Class<?>[] getAnnotatedClasses() {
// No test needed at this time. This was purely to test a