diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/StringHelper.java b/hibernate-core/src/main/java/org/hibernate/internal/util/StringHelper.java index 7d8a3fa23a..bf8856ec01 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/StringHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/StringHelper.java @@ -513,7 +513,7 @@ public final class StringHelper { */ public static String generateAlias(String description, int unique) { return generateAliasRoot(description) + - Integer.toString(unique) + + unique + '_'; } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/Binder.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/Binder.java index 47a26d73e2..eb2d15bf00 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/Binder.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/Binder.java @@ -182,6 +182,7 @@ import org.jboss.logging.Logger; * @author Hardy Ferentschik * @author Gail Badner * @author Brett Meyer + * @author Strong Liu */ public class Binder { private static final CoreMessageLogger log = Logger.getMessageLogger( @@ -1410,7 +1411,7 @@ public class Binder { attributeBinding.setCustomSqlDelete( attributeSource.getCustomSqlDelete() ); attributeBinding.setCustomSqlDeleteAll( attributeSource.getCustomSqlDeleteAll() ); attributeBinding.setWhere( attributeSource.getWhere() ); - + attributeBinding.setMutable( attributeSource.isMutable() ); switch ( attributeSource.getElementSource().getNature() ) { case BASIC: bindBasicPluralAttribute( attributeSource, attributeBinding, reflectedCollectionJavaTypes ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeSourceImpl.java index 044fe4b621..c144438960 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeSourceImpl.java @@ -257,6 +257,11 @@ public class PluralAttributeSourceImpl implements PluralAttributeSource, Orderab return associationAttribute.getOrderBy(); } + @Override + public boolean isMutable() { + return associationAttribute.isMutable(); + } + @Override public boolean isOrdered() { return StringHelper.isNotEmpty( getOrder() ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/PluralAssociationAttribute.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/PluralAssociationAttribute.java index f92f23d1c3..a82f5174c3 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/PluralAssociationAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/PluralAssociationAttribute.java @@ -85,6 +85,7 @@ public class PluralAssociationAttribute extends AssociationAttribute { private LazyCollectionOption lazyOption; private final boolean isCollectionIdPresent; + private final boolean mutable; public static PluralAssociationAttribute createPluralAssociationAttribute( @@ -207,6 +208,8 @@ public class PluralAssociationAttribute extends AssociationAttribute { inverseForeignKeyName = null; } + this.mutable = JandexHelper.getSingleAnnotation( annotations(), HibernateDotNames.IMMUTABLE ) == null; + this.caching = determineCachingSettings(); this.isExtraLazy = lazyOption == LazyCollectionOption.EXTRA; this.customPersister = determineCustomPersister(); @@ -487,6 +490,9 @@ public class PluralAssociationAttribute extends AssociationAttribute { } + public boolean isMutable() { + return mutable; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/EntityClass.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/EntityClass.java index 9e48deb27e..d2459fedf9 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/EntityClass.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/EntityClass.java @@ -334,13 +334,7 @@ public class EntityClass extends ConfiguredClass { HibernateDotNames.IMMUTABLE, ClassInfo.class ); - if ( hibernateImmutableAnnotation != null ) { - isImmutable = true; - } - else { - isImmutable = false; - } - + isImmutable = hibernateImmutableAnnotation != null ; final AnnotationInstance whereAnnotation = JandexHelper.getSingleAnnotation( getClassInfo(), HibernateDotNames.WHERE ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractPluralAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractPluralAttributeSourceImpl.java index 452c8a0603..9ff6cb6135 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractPluralAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractPluralAttributeSourceImpl.java @@ -191,6 +191,11 @@ public abstract class AbstractPluralAttributeSourceImpl return elementClassReference; } + @Override + public boolean isMutable() { + return pluralAttributeElement.isMutable(); + } + @Override public String getMappedBy() { return null; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ColumnSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ColumnSourceImpl.java index 12a1ad36ef..97e5fc2d0d 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ColumnSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ColumnSourceImpl.java @@ -98,9 +98,9 @@ class ColumnSourceImpl @Override public Size getSize() { return new Size( - Helper.getValue( columnElement.getPrecision(), -1 ), - Helper.getValue( columnElement.getScale(), -1 ), - Helper.getValue( columnElement.getLength(), -1 ), + Helper.getValue( columnElement.getPrecision(), Size.DEFAULT_PRECISION ), + Helper.getValue( columnElement.getScale(), Size.DEFAULT_SCALE ), + Helper.getValue( columnElement.getLength(), Size.DEFAULT_LENGTH ), Size.LobMultiplier.NONE ); } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityBinding.java index d029bd82aa..8140588487 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityBinding.java @@ -26,7 +26,6 @@ package org.hibernate.metamodel.spi.binding; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -38,9 +37,6 @@ import org.hibernate.internal.FilterConfiguration; import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.ValueHolder; import org.hibernate.internal.util.collections.ArrayHelper; -import org.hibernate.internal.util.collections.JoinedIterable; -import org.hibernate.internal.util.collections.JoinedIterator; -import org.hibernate.internal.util.collections.SingletonIterator; import org.hibernate.metamodel.spi.domain.AttributeContainer; import org.hibernate.metamodel.spi.domain.Entity; import org.hibernate.metamodel.spi.domain.SingularAttribute; @@ -58,6 +54,7 @@ import org.hibernate.tuple.entity.EntityTuplizer; * @author Steve Ebersole * @author Hardy Ferentschik * @author Gail Badner + * @author Strong Liu */ public class EntityBinding extends AbstractAttributeBindingContainer implements Filterable { private static final String NULL_DISCRIMINATOR_MATCH_VALUE = "null"; @@ -592,8 +589,7 @@ public class EntityBinding extends AbstractAttributeBindingContainer implements */ public int getAttributeBindingClosureSpan() { // TODO: update account for join attribute bindings - return isRoot() ? getNonIdAttributeBindingClosure().length : - superEntityBinding.getAttributeBindingClosureSpan() + getNonIdAttributeBindingClosure().length; + return getAttributeBindingClosure().length; } /** @@ -606,23 +602,35 @@ public class EntityBinding extends AbstractAttributeBindingContainer implements public AttributeBinding[] getAttributeBindingClosure() { // TODO: update size to account for joins if ( isRoot() ) { - return getNonIdAttributeBindingClosure(); + return attributeBindingMapInternal().values() + .toArray( new AttributeBinding[attributeBindingMapInternal().size()] ); } else { return ArrayHelper.join( superEntityBinding.getAttributeBindingClosure(), - getNonIdAttributeBindingClosure() + attributeBindingMapInternal().values() + .toArray( new AttributeBinding[attributeBindingMapInternal().size()] ) + ); } } - private AttributeBinding[] getNonIdAttributeBindingClosure() { - List list = new ArrayList(); - attributeBindings(); - for ( final AttributeBinding ab : attributeBindings() ) { - if(ab instanceof CompositeAttributeBinding){ + public AttributeBinding[] getNonIdAttributeBindingClosure(){ + // TODO: update size to account for joins + if ( isRoot() ) { + return internalGetNonIdAttributeBindingClosure(); + } + else { + return ArrayHelper.join( + superEntityBinding.getNonIdAttributeBindingClosure(), + internalGetNonIdAttributeBindingClosure() + ); + } + } - } + private AttributeBinding[] internalGetNonIdAttributeBindingClosure() { + List list = new ArrayList(); + for ( final AttributeBinding ab : attributeBindings() ) { boolean isId = getHierarchyDetails().getEntityIdentifier().isIdentifierAttributeBinding( ab ); if ( !isId ) { list.add( ab ); @@ -739,13 +747,26 @@ public class EntityBinding extends AbstractAttributeBindingContainer implements results = ArrayHelper.join( results, - subEntityBinding.getNonIdAttributeBindingClosure() + subEntityBinding.attributeBindingMapInternal().values().toArray( new AttributeBinding[subEntityBinding.attributeBindingMapInternal().size()] ) ); // TODO: if EntityBinding.attributeBindings() excludes joined attributes, then they need to be added here } return results; } + public AttributeBinding[] getNonIdEntitiesAttributeBindingClosure() { + AttributeBinding[] results = getNonIdAttributeBindingClosure(); + for ( EntityBinding subEntityBinding : getPreOrderSubEntityBindingClosure() ) { + // only add attribute bindings declared for the subEntityBinding + + results = ArrayHelper.join( + results, + subEntityBinding.internalGetNonIdAttributeBindingClosure() + ); + // TODO: if EntityBinding.attributeBindings() excludes joined attributes, then they need to be added here + } + return results; + } public boolean isClassOrSuperclassSecondaryTable(SecondaryTable secondaryTable) { String secondaryTableName = secondaryTable.getSecondaryTableReference().getLogicalName().getText(); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityIdentifier.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityIdentifier.java index 3ab1bb2905..fff23573fe 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityIdentifier.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityIdentifier.java @@ -140,19 +140,17 @@ public class EntityIdentifier { public Class getIdClassClass() { ensureBound(); - if ( ! isNonAggregatedComposite() ) { - throw new UnsupportedOperationException( - String.format( - "Entity identifiers of nature %s does not support idClasses.", - entityIdentifierBinding.getNature() - ) - ); - } + ensureNonAggregatedComposite(); return ( (NonAggregatedCompositeIdentifierBindingImpl) entityIdentifierBinding ).getIdClassClass(); } public String getIdClassPropertyAccessorName() { ensureBound(); + ensureNonAggregatedComposite(); + return ( (NonAggregatedCompositeIdentifierBindingImpl) entityIdentifierBinding ).getIdClassPropertyAccessorName(); + } + + private void ensureNonAggregatedComposite() { if ( ! isNonAggregatedComposite() ) { throw new UnsupportedOperationException( String.format( @@ -161,7 +159,6 @@ public class EntityIdentifier { ) ); } - return ( (NonAggregatedCompositeIdentifierBindingImpl) entityIdentifierBinding ).getIdClassPropertyAccessorName(); } public boolean isIdentifierMapper() { @@ -409,6 +406,10 @@ public class EntityIdentifier { return (CompositeAttributeBinding) getAttributeBinding(); } public boolean isIdentifierAttributeBinding(AttributeBinding attributeBinding) { + if ( !isIdentifierMapper() && getNonAggregatedCompositeAttributeBinding().equals( attributeBinding ) ) { + return true; + + } for ( AttributeBinding idAttributeBindings : getNonAggregatedCompositeAttributeBinding().attributeBindings() ) { if ( idAttributeBindings.equals( attributeBinding ) ) { return true; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/ForeignKey.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/ForeignKey.java index 7bdfbdfdf6..46f837c439 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/ForeignKey.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/ForeignKey.java @@ -43,7 +43,7 @@ import org.hibernate.dialect.Dialect; * @author Gavin King * @author Steve Ebersole */ -public class ForeignKey extends AbstractConstraint implements Constraint, Exportable { +public class ForeignKey extends AbstractConstraint { private static final Logger LOG = Logger.getLogger( ForeignKey.class ); private static final String ON_DELETE = " on delete "; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/Index.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/Index.java index 516ce802ff..9fcb3065c0 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/Index.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/Index.java @@ -31,7 +31,7 @@ import org.hibernate.dialect.Dialect; * @author Gavin King * @author Steve Ebersole */ -public class Index extends AbstractConstraint implements Constraint { +public class Index extends AbstractConstraint{ protected Index(Table table, String name) { super( table, name ); } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/PrimaryKey.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/PrimaryKey.java index 61686fb29b..12a812c7ee 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/PrimaryKey.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/PrimaryKey.java @@ -34,7 +34,7 @@ import org.hibernate.dialect.Dialect; * @author Gavin King * @author Steve Ebersole */ -public class PrimaryKey extends AbstractConstraint implements Constraint, Exportable { +public class PrimaryKey extends AbstractConstraint { private static final String GENERATED_NAME_PREFIX = "PK"; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/UniqueKey.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/UniqueKey.java index 2eb354123e..0d8dc17160 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/UniqueKey.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/UniqueKey.java @@ -31,7 +31,7 @@ import org.hibernate.dialect.Dialect; * @author Gavin King * @author Steve Ebersole */ -public class UniqueKey extends AbstractConstraint implements Constraint { +public class UniqueKey extends AbstractConstraint { private static final String GENERATED_NAME_PREFIX = "UK"; protected UniqueKey(Table table, String name) { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeSource.java index 1c47fc8e11..97441a5337 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeSource.java @@ -61,6 +61,8 @@ public interface PluralAttributeSource public boolean isInverse(); + public boolean isMutable(); + public String getCustomLoaderName(); public CustomSQL getCustomSqlInsert(); diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java index b419af166a..c7938d49a1 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java @@ -851,10 +851,10 @@ public abstract class AbstractEntityPersister this.factory = factory; this.cacheAccessStrategy = cacheAccessStrategy; this.naturalIdRegionAccessStrategy = naturalIdRegionAccessStrategy; - this.isLazyPropertiesCacheable = - entityBinding.getHierarchyDetails().getCaching() == null ? - false : - entityBinding.getHierarchyDetails().getCaching().isCacheLazyProperties(); + this.isLazyPropertiesCacheable = entityBinding.getHierarchyDetails() + .getCaching() == null || entityBinding.getHierarchyDetails() + .getCaching() + .isCacheLazyProperties(); this.entityMetamodel = new EntityMetamodel( entityBinding, factory ); this.entityTuplizer = this.entityMetamodel.getTuplizer(); int batch = entityBinding.getBatchSize(); @@ -951,12 +951,7 @@ public abstract class AbstractEntityPersister int i = 0; boolean foundFormula = false; - for ( AttributeBinding attributeBinding : entityBinding.getAttributeBindingClosure() ) { - if ( entityBinding.getHierarchyDetails().getEntityIdentifier().isIdentifierAttributeBinding( attributeBinding ) ) { - // entity identifier is not considered a "normal" property - continue; - } - + for ( AttributeBinding attributeBinding : entityBinding.getNonIdAttributeBindingClosure() ) { thisClassProperties.add( attributeBinding ); propertySubclassNames[i] = ( (EntityBinding) attributeBinding.getContainer() ).getEntity().getName(); @@ -1054,12 +1049,7 @@ public abstract class AbstractEntityPersister List columnSelectables = new ArrayList(); List propNullables = new ArrayList(); - for ( AttributeBinding attributeBinding : entityBinding.getEntitiesAttributeBindingClosure() ) { - if ( entityBinding.getHierarchyDetails().getEntityIdentifier().isIdentifierAttributeBinding( attributeBinding ) ) { - // entity identifier is not considered a "normal" property - continue; - } - + for ( AttributeBinding attributeBinding : entityBinding.getNonIdEntitiesAttributeBindingClosure() ) { names.add( attributeBinding.getAttribute().getName() ); classes.add( ( (EntityBinding) attributeBinding.getContainer() ).getEntity().getName() ); boolean isDefinedBySubclass = ! thisClassProperties.contains( attributeBinding ); @@ -1199,6 +1189,9 @@ public abstract class AbstractEntityPersister this.cacheEntryHelper = buildCacheEntryHelper(); } + + + protected static String getTemplateFromString(String string, SessionFactoryImplementor factory) { return string == null ? null : @@ -4384,10 +4377,6 @@ public abstract class AbstractEntityPersister return entityMetamodel.getTuplizer().createProxy( id, session ); } - public String toString() { - return StringHelper.unqualify( getClass().getName() ) + - '(' + entityMetamodel.getName() + ')'; - } public final String selectFragment( Joinable rhs, @@ -4989,6 +4978,11 @@ public abstract class AbstractEntityPersister return lazyPropertyColumnAliases; } + public String toString() { + return StringHelper.unqualify( getClass().getName() ) + + '(' + entityMetamodel.getName() + ')'; + } + /** * Consolidated these onto a single helper because the 2 pieces work in tandem. */ diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java index eb2e7bfc35..410295356e 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java @@ -25,6 +25,8 @@ package org.hibernate.persister.entity; import java.io.Serializable; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -54,7 +56,6 @@ import org.hibernate.mapping.Subclass; import org.hibernate.mapping.Table; import org.hibernate.metamodel.spi.binding.AttributeBinding; import org.hibernate.metamodel.spi.binding.EntityBinding; -import org.hibernate.metamodel.spi.binding.PluralAttributeBinding; import org.hibernate.metamodel.spi.binding.RelationalValueBinding; import org.hibernate.metamodel.spi.binding.SecondaryTable; import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; @@ -62,13 +63,15 @@ import org.hibernate.metamodel.spi.relational.PrimaryKey; import org.hibernate.metamodel.spi.relational.TableSpecification; import org.hibernate.sql.CaseFragment; import org.hibernate.sql.SelectFragment; -import org.hibernate.type.*; +import org.hibernate.type.StandardBasicTypes; +import org.hibernate.type.Type; /** * An EntityPersister implementing the normalized "table-per-subclass" * mapping strategy * * @author Gavin King + * @author Strong Liu */ public class JoinedSubclassEntityPersister extends AbstractEntityPersister { @@ -689,13 +692,13 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister { final TableSpecification[] tables = entityBinding.getTableClosure(); final SecondaryTable[] secondaryTables = entityBinding.getSecondaryTableClosure(); final String[] synchronizedTableNames = entityBinding.getSynchronizedTableNameClosure(); - final AttributeBinding[] attributeBindings = entityBinding.getAttributeBindingClosure(); + final AttributeBinding[] attributeBindings = entityBinding.getNonIdAttributeBindingClosure(); //todo the count of these two are not equal, which they should be final EntityBinding[] preOrderSubEntityBindings = entityBinding.getPreOrderSubEntityBindingClosure(); final EntityBinding[] postOrderSubEntityBindings = entityBinding.getPostOrderSubEntityBindingClosure(); final TableSpecification[] subTables = entityBinding.getPreOrderSubTableClosure(); final SecondaryTable[] subSecondaryTables = entityBinding.getSubEntitySecondaryTables(); - final AttributeBinding[] allAttributeBindings = entityBinding.getEntitiesAttributeBindingClosure(); + final AttributeBinding[] allAttributeBindings = entityBinding.getNonIdEntitiesAttributeBindingClosure(); final int idColumnSpan = getIdentifierColumnSpan(); coreTableSpan = tables.length; @@ -924,11 +927,9 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister { valueBindings = singularAttributeBinding.getRelationalValueBindings(); } else { - PluralAttributeBinding pluralAttributeBinding = PluralAttributeBinding.class.cast( attributeBinding ); - valueBindings = pluralAttributeBinding.getPluralAttributeElementBinding().getRelationalValueBindings(); + valueBindings = Collections.EMPTY_LIST; } - RelationalValueBinding valueBinding = valueBindings.get( 0 ); - TableSpecification table = valueBinding.getValue().getTable(); + TableSpecification table = attributeBinding.getContainer().seekEntityBinding().getPrimaryTable();// valueBinding.getValue().getTable(); final String tableName = table.getQualifiedName( factory.getDialect() ); if ( i < hydrateSpan ) { propertyTableNumbers[i] = getTableId( tableName, tableNames ); diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java index 7b6cff825b..1d58d3a678 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java @@ -23,8 +23,10 @@ * */ package org.hibernate.persister.entity; + import java.io.Serializable; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -53,9 +55,9 @@ import org.hibernate.mapping.Subclass; import org.hibernate.mapping.Table; import org.hibernate.mapping.Value; import org.hibernate.metamodel.spi.binding.AttributeBinding; -import org.hibernate.metamodel.spi.binding.CustomSQL; import org.hibernate.metamodel.spi.binding.EntityBinding; import org.hibernate.metamodel.spi.binding.EntityDiscriminator; +import org.hibernate.metamodel.spi.binding.EntityIdentifier; import org.hibernate.metamodel.spi.binding.RelationalValueBinding; import org.hibernate.metamodel.spi.binding.SecondaryTable; import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; @@ -648,16 +650,11 @@ public class SingleTableEntityPersister extends AbstractEntityPersister { } // PROPERTIES - propertyTableNumbers = new int[ getPropertySpan() ]; int i=0; - for( AttributeBinding attributeBinding : entityBinding.getAttributeBindingClosure() ) { + for( AttributeBinding attributeBinding : entityBinding.getNonIdAttributeBindingClosure() ) { // TODO: fix when joins are working (HHH-6391) //propertyTableNumbers[i++] = entityBinding.getJoinNumber( attributeBinding); - if ( entityBinding.getHierarchyDetails().getEntityIdentifier().isIdentifierAttributeBinding( attributeBinding ) ) { - continue; // skip identifier binding - } - final int tableNumber; if ( attributeBinding.getAttribute().isSingular() ) { SingularAttributeBinding singularAttributeBinding = (SingularAttributeBinding) attributeBinding; @@ -675,11 +672,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister { ArrayList formulaJoinedNumbers = new ArrayList(); ArrayList propertyJoinNumbers = new ArrayList(); - for ( AttributeBinding attributeBinding : entityBinding.getEntitiesAttributeBindingClosure() ) { - if ( entityBinding.getHierarchyDetails().getEntityIdentifier().isIdentifierAttributeBinding( attributeBinding ) ) { - continue; // skip identifier binding - } - + for ( AttributeBinding attributeBinding : entityBinding.getNonIdEntitiesAttributeBindingClosure() ) { if ( attributeBinding.getAttribute().isSingular() ) { SingularAttributeBinding singularAttributeBinding = (SingularAttributeBinding) attributeBinding; int join = entityBinding.getSecondaryTableNumber( singularAttributeBinding ); @@ -752,7 +745,6 @@ public class SingleTableEntityPersister extends AbstractEntityPersister { postConstruct( mapping ); } - protected boolean isInverseTable(int j) { return isInverseTable[j]; } diff --git a/hibernate-core/src/main/java/org/hibernate/sql/Insert.java b/hibernate-core/src/main/java/org/hibernate/sql/Insert.java index 90788e25af..a78e0ebfc4 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/Insert.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/Insert.java @@ -27,7 +27,10 @@ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; +import org.jboss.logging.Logger; + import org.hibernate.dialect.Dialect; +import org.hibernate.internal.CoreMessageLogger; import org.hibernate.type.LiteralType; /** @@ -39,7 +42,9 @@ public class Insert { private Dialect dialect; private String tableName; private String comment; - private Map columns = new LinkedHashMap(); + private Map columns = new LinkedHashMap(); + private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, + Insert.class.getName()); public Insert(Dialect dialect) { this.dialect = dialect; @@ -59,8 +64,8 @@ public class Insert { } public Insert addColumns(String[] columnNames) { - for ( int i=0; i iter = columns.keySet().iterator(); while ( iter.hasNext() ) { buf.append( iter.next() ); if ( iter.hasNext() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java index 90c0ca8fd4..35f473f7a3 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java @@ -241,11 +241,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer { boolean foundCustomAccessor = false; int i = 0; - for ( AttributeBinding property : mappingInfo.getAttributeBindingClosure() ) { - if ( mappingInfo.getHierarchyDetails().getEntityIdentifier().isIdentifierAttributeBinding( property ) ) { - continue; // ID binding processed above - } - + for ( AttributeBinding property : mappingInfo.getNonIdAttributeBindingClosure() ) { //TODO: redesign how PropertyAccessors are acquired... getters[ i ] = buildPropertyGetter( property ); setters[ i ] = buildPropertySetter( property ); diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java index 092ce89fd4..9a0c5fceba 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java @@ -398,22 +398,7 @@ public class EntityMetamodel implements Serializable { boolean hasLazy = false; // TODO: Fix after HHH-6337 is fixed; for now assume entityBinding is the root binding - final EntityIdentifier rootEntityIdentifier = entityBinding.getHierarchyDetails().getEntityIdentifier(); - // entityBinding.getAttributeClosureSpan() includes the identifier binding; - // "properties" here excludes the ID, so subtract 1 if the identifier binding is non-null - int identifierAttributeBindingSpan; - if ( rootEntityIdentifier.getAttributeBinding() == null ) { - identifierAttributeBindingSpan = 0; - } - else if ( rootEntityIdentifier.isNonAggregatedComposite() ) { - identifierAttributeBindingSpan = - ( (CompositeAttributeBinding) rootEntityIdentifier.getAttributeBinding() ).attributeBindingSpan(); - } - else { - identifierAttributeBindingSpan = 1; - } - - final AttributeBinding [] attributeBindings = entityBinding.getAttributeBindingClosure(); + final AttributeBinding [] attributeBindings = entityBinding.getNonIdAttributeBindingClosure(); propertySpan = attributeBindings.length; properties = new StandardProperty[propertySpan]; @@ -445,11 +430,6 @@ public class EntityMetamodel implements Serializable { boolean foundUpdateableNaturalIdProperty = false; for ( AttributeBinding attributeBinding : attributeBindings ) { - if ( entityBinding.getHierarchyDetails().getEntityIdentifier().isIdentifierAttributeBinding( attributeBinding ) ) { - // skip the identifier attribute binding - continue; - } - if ( attributeBinding == entityBinding.getHierarchyDetails().getEntityVersion().getVersioningAttributeBinding() ) { tempVersionProperty = i; properties[i] = PropertyFactory.buildVersionProperty( diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/InheritanceBindingTest.java b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/InheritanceBindingTest.java index b7f2926afb..cc5a9fa7a2 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/InheritanceBindingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/InheritanceBindingTest.java @@ -135,22 +135,22 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase { noInheritanceEntityBinding.getHierarchyDetails().getEntityIdentifier().getAttributeBinding(), directAttributeBindings.iterator().next() ); - assertEquals( 0, noInheritanceEntityBinding.getAttributeBindingClosureSpan() ); + assertEquals( 1, noInheritanceEntityBinding.getAttributeBindingClosureSpan() ); Iterator iterator = noInheritanceEntityBinding.attributeBindings().iterator(); assertTrue( iterator.hasNext() ); assertSame( noInheritanceEntityBinding.getHierarchyDetails().getEntityIdentifier().getAttributeBinding(), iterator.next() ); assertFalse( iterator.hasNext() ); AttributeBinding[] attributeBindings = noInheritanceEntityBinding.getAttributeBindingClosure(); - assertTrue( attributeBindings.length == 0 ); -// int index =0; -// assertSame( noInheritanceEntityBinding.getHierarchyDetails().getEntityIdentifier().getAttributeBinding(), attributeBindings[index++] ); -// assertFalse( index < attributeBindings.length ); + assertTrue( attributeBindings.length > 0 ); + int index =0; + assertSame( noInheritanceEntityBinding.getHierarchyDetails().getEntityIdentifier().getAttributeBinding(), attributeBindings[index++] ); + assertFalse( index < attributeBindings.length ); attributeBindings = noInheritanceEntityBinding.getEntitiesAttributeBindingClosure(); -// int index = 0; - assertFalse( attributeBindings.length > 0 ); -// assertSame( noInheritanceEntityBinding.getHierarchyDetails().getEntityIdentifier().getAttributeBinding(), attributeBindings[index++] ); -// assertFalse( index < attributeBindings.length ); + index = 0; + assertTrue( attributeBindings.length > 0 ); + assertSame( noInheritanceEntityBinding.getHierarchyDetails().getEntityIdentifier().getAttributeBinding(), attributeBindings[index++] ); + assertFalse( index < attributeBindings.length ); } @Test @@ -193,19 +193,19 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase { } assertEquals( 1, directAttributeBindings.size() ); assertTrue( directAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); - assertEquals( 0, rootEntityBinding.getAttributeBindingClosureSpan() ); + assertEquals( 1, rootEntityBinding.getAttributeBindingClosureSpan() ); Set attributeBindingClosure = new HashSet(); for ( AttributeBinding attributeBinding : rootEntityBinding.getAttributeBindingClosure() ) { assertTrue( attributeBindingClosure.add( attributeBinding ) ); } - assertEquals( 0, attributeBindingClosure.size() ); - assertFalse( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); + assertEquals( 1, attributeBindingClosure.size() ); + assertTrue( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); Set subAttributeBindings = new HashSet(); for ( AttributeBinding subAttributeBinding : rootEntityBinding.getEntitiesAttributeBindingClosure() ) { assertTrue( subAttributeBindings.add( subAttributeBinding ) ); } - assertEquals( 3, subAttributeBindings.size() ); - assertFalse( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); + assertEquals( 4, subAttributeBindings.size() ); + assertTrue( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); assertTrue( subAttributeBindings.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) ); assertTrue( subAttributeBindings.contains( subclassOfSubclassEntityBinding.locateAttributeBinding( "otherOtherName" ) ) ); assertTrue( subAttributeBindings.contains( otherSubclassEntityBinding.locateAttributeBinding( "otherName" ) ) ); @@ -310,20 +310,20 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase { } assertEquals( 1, directAttributeBindings.size() ); assertTrue( directAttributeBindings.contains( otherSubclassEntityBinding.locateAttributeBinding( "otherName" ) ) ); - assertEquals( 1, otherSubclassEntityBinding.getAttributeBindingClosureSpan() ); + assertEquals( 2, otherSubclassEntityBinding.getAttributeBindingClosureSpan() ); Set attributeBindingClosure = new HashSet(); for ( AttributeBinding attributeBinding : otherSubclassEntityBinding.getAttributeBindingClosure() ) { assertTrue( attributeBindingClosure.add( attributeBinding ) ); } - assertEquals(1, attributeBindingClosure.size() ); - assertFalse( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); + assertEquals(2, attributeBindingClosure.size() ); + assertTrue( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); assertTrue( attributeBindingClosure.contains( otherSubclassEntityBinding.locateAttributeBinding( "otherName" ) ) ); Set subAttributeBindings = new HashSet(); for ( AttributeBinding subAttributeBinding : otherSubclassEntityBinding.getEntitiesAttributeBindingClosure() ) { assertTrue( subAttributeBindings.add( subAttributeBinding ) ); } - assertEquals( 1, subAttributeBindings.size() ); - assertFalse( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); + assertEquals( 2, subAttributeBindings.size() ); + assertTrue( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); assertTrue( subAttributeBindings.contains( otherSubclassEntityBinding.locateAttributeBinding( "otherName" ) ) ); } @@ -364,20 +364,20 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase { } assertEquals( 1, directAttributeBindings.size() ); assertTrue( directAttributeBindings.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) ); - assertEquals( 1, subclassEntityBinding.getAttributeBindingClosureSpan() ); + assertEquals( 2, subclassEntityBinding.getAttributeBindingClosureSpan() ); Set attributeBindingClosure = new HashSet(); for ( AttributeBinding attributeBinding : subclassEntityBinding.getAttributeBindingClosure() ) { assertTrue( attributeBindingClosure.add( attributeBinding ) ); } - assertEquals( 1, attributeBindingClosure.size() ); - assertFalse( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); + assertEquals( 2, attributeBindingClosure.size() ); + assertTrue( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); assertTrue( attributeBindingClosure.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) ); Set subAttributeBindings = new HashSet(); for ( AttributeBinding subAttributeBinding : subclassEntityBinding.getEntitiesAttributeBindingClosure() ) { assertTrue( subAttributeBindings.add( subAttributeBinding ) ); } - assertEquals( 2, subAttributeBindings.size() ); - assertFalse( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); + assertEquals( 3, subAttributeBindings.size() ); + assertTrue( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); assertTrue( subAttributeBindings.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) ); assertTrue( subAttributeBindings.contains( subclassOfSubclassEntityBinding.locateAttributeBinding( "otherOtherName" ) ) ); } @@ -411,21 +411,21 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase { } assertEquals( 1, directAttributeBindings.size() ); assertTrue( directAttributeBindings.contains( subclassOfSubclassEntityBinding.locateAttributeBinding( "otherOtherName" ) ) ); - assertEquals( 2, subclassOfSubclassEntityBinding.getAttributeBindingClosureSpan() ); + assertEquals( 3, subclassOfSubclassEntityBinding.getAttributeBindingClosureSpan() ); Set attributeBindingClosure = new HashSet(); for ( AttributeBinding attributeBinding : subclassOfSubclassEntityBinding.getAttributeBindingClosure() ) { assertTrue( attributeBindingClosure.add( attributeBinding ) ); } - assertEquals( 2, attributeBindingClosure.size() ); - assertFalse( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); + assertEquals( 3, attributeBindingClosure.size() ); + assertTrue( attributeBindingClosure.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); assertTrue( attributeBindingClosure.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) ); assertTrue( attributeBindingClosure.contains( subclassOfSubclassEntityBinding.locateAttributeBinding( "otherOtherName" ) ) ); Set subAttributeBindings = new HashSet(); for ( AttributeBinding subAttributeBinding : subclassOfSubclassEntityBinding.getEntitiesAttributeBindingClosure() ) { assertTrue( subAttributeBindings.add( subAttributeBinding ) ); } - assertEquals( 2, subAttributeBindings.size() ); - assertFalse( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); + assertEquals( 3, subAttributeBindings.size() ); + assertTrue( subAttributeBindings.contains( rootEntityBinding.locateAttributeBinding( "id" ) ) ); assertTrue( subAttributeBindings.contains( subclassEntityBinding.locateAttributeBinding( "name" ) ) ); assertTrue( subAttributeBindings.contains( subclassOfSubclassEntityBinding.locateAttributeBinding( "otherOtherName" ) ) ); } @@ -455,23 +455,23 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase { assertEquals( "base", rootEntityBinding.getDiscriminatorMatchValue() ); } - @Test - @Resources(annotatedClasses = { Fruit.class, Apple.class }) - public void testDiscriminatorFormula() { - EntityBinding rootEntityBinding = getEntityBinding( Fruit.class ); - assertTrue( rootEntityBinding.isRoot() ); - EntityBinding entityBinding = getEntityBinding( Apple.class ); - assertFalse( entityBinding.isRoot() ); + @Test + @Resources(annotatedClasses = { Fruit.class, Apple.class }) + public void testDiscriminatorFormula() { + EntityBinding rootEntityBinding = getEntityBinding( Fruit.class ); + assertTrue( rootEntityBinding.isRoot() ); + EntityBinding entityBinding = getEntityBinding( Apple.class ); + assertFalse( entityBinding.isRoot() ); EntityDiscriminator discriminator = rootEntityBinding.getHierarchyDetails().getEntityDiscriminator(); - Value simpleValue = discriminator.getRelationalValue(); - assertTrue( simpleValue instanceof DerivedValue); - DerivedValue derivedValue = (DerivedValue)simpleValue; - assertEquals( "case when zik_type is null then 0 else zik_type end", derivedValue.getExpression() ); + Value simpleValue = discriminator.getRelationalValue(); + assertTrue( simpleValue instanceof DerivedValue); + DerivedValue derivedValue = (DerivedValue)simpleValue; + assertEquals( "case when zik_type is null then 0 else zik_type end", derivedValue.getExpression() ); assertTrue( "Wrong default value", discriminator.isForced() ); assertFalse( "Wrong default value", discriminator.isInserted() ); - } + } - @Entity + @Entity class SingleEntity { @Id @GeneratedValue @@ -516,19 +516,19 @@ public class InheritanceBindingTest extends BaseAnnotationBindingTestCase { class Jump extends Base { } - @Entity - @DiscriminatorColumn(discriminatorType = DiscriminatorType.INTEGER) - @DiscriminatorFormula("case when zik_type is null then 0 else zik_type end") - @DiscriminatorOptions(force = true, insert = false) - class Fruit { - @Id - private int id; - } + @Entity + @DiscriminatorColumn(discriminatorType = DiscriminatorType.INTEGER) + @DiscriminatorFormula("case when zik_type is null then 0 else zik_type end") + @DiscriminatorOptions(force = true, insert = false) + class Fruit { + @Id + private int id; + } - @Entity - class Apple extends Fruit { + @Entity + class Apple extends Fruit { - } + } } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/a/DerivedIdentitySimpleParentIdClassDepTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/a/DerivedIdentitySimpleParentIdClassDepTest.java index 2c7936c3b3..7307218935 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/a/DerivedIdentitySimpleParentIdClassDepTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/a/DerivedIdentitySimpleParentIdClassDepTest.java @@ -40,9 +40,10 @@ import static org.junit.Assert.assertTrue; /** * @author Emmanuel Bernard */ + public class DerivedIdentitySimpleParentIdClassDepTest extends BaseCoreFunctionalTestCase { - @FailureExpectedWithNewMetamodel @Test + @FailureExpectedWithNewMetamodel public void testManyToOne() throws Exception { assertTrue( SchemaUtil.isColumnPresent( "Dependent", "emp_empId", metadata() ) ); assertTrue( ! SchemaUtil.isColumnPresent( "Dependent", "emp", metadata() ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/immutable/ImmutableTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/immutable/ImmutableTest.java index 3c7bd3209e..b91f6d84fa 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/immutable/ImmutableTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/immutable/ImmutableTest.java @@ -34,7 +34,6 @@ import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; -import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.ServiceRegistryBuilder; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; @@ -84,7 +83,6 @@ public class ImmutableTest extends BaseCoreFunctionalTestCase { } @Test - @FailureExpectedWithNewMetamodel public void testImmutableCollection() { Country country = new Country(); country.setName("Germany"); diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java b/hibernate-core/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java index f0487563d8..845ce0f374 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java @@ -82,7 +82,6 @@ import static org.junit.Assert.fail; * @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com) */ @RequiresDialectFeature(DialectChecks.SupportsSequences.class) -@FailureExpectedWithNewMetamodel public class CriteriaQueryTest extends BaseCoreFunctionalTestCase { @Override public String[] getMappings() { @@ -1733,6 +1732,7 @@ public class CriteriaQueryTest extends BaseCoreFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testCriteriaCollectionOfValue() { Session session = openSession(); Transaction t = session.beginTransaction(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/hql/ASTParserLoadingOrderByTest.java b/hibernate-core/src/test/java/org/hibernate/test/hql/ASTParserLoadingOrderByTest.java index e41e59292c..0e14b36547 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hql/ASTParserLoadingOrderByTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/hql/ASTParserLoadingOrderByTest.java @@ -47,7 +47,7 @@ import static org.junit.Assert.assertTrue; * * @author Gail Badner */ -@FailureExpectedWithNewMetamodel +//@FailureExpectedWithNewMetamodel public class ASTParserLoadingOrderByTest extends BaseCoreFunctionalTestCase { StateProvince stateProvince; private Zoo zoo1; @@ -205,6 +205,7 @@ public class ASTParserLoadingOrderByTest extends BaseCoreFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testOrderByNoSelectAliasRef() { createData(); @@ -346,6 +347,7 @@ public class ASTParserLoadingOrderByTest extends BaseCoreFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testOrderBySelectAliasRef() { createData(); @@ -523,6 +525,7 @@ public class ASTParserLoadingOrderByTest extends BaseCoreFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testOrderByEntityWithFetchJoinedCollection() { createData(); @@ -544,6 +547,7 @@ public class ASTParserLoadingOrderByTest extends BaseCoreFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testOrderBySelectNewArgAliasRef() { createData(); @@ -588,6 +592,7 @@ public class ASTParserLoadingOrderByTest extends BaseCoreFunctionalTestCase { } @Test(timeout = 5 * 60 * 1000) + @FailureExpectedWithNewMetamodel public void testOrderBySelectNewMapArgAliasRef() { createData(); @@ -638,6 +643,7 @@ public class ASTParserLoadingOrderByTest extends BaseCoreFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testOrderByAggregatedArgAliasRef() { createData(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/hql/CriteriaHQLAlignmentTest.java b/hibernate-core/src/test/java/org/hibernate/test/hql/CriteriaHQLAlignmentTest.java index cf74dfe62a..01b415df94 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hql/CriteriaHQLAlignmentTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/hql/CriteriaHQLAlignmentTest.java @@ -56,7 +56,7 @@ import static org.junit.Assert.fail; * * @author Max Rydahl Andersen */ -@FailureExpectedWithNewMetamodel +//@FailureExpectedWithNewMetamodel public class CriteriaHQLAlignmentTest extends QueryTranslatorTestCase { private boolean initialVersion2SqlFlagValue; @@ -161,6 +161,7 @@ public class CriteriaHQLAlignmentTest extends QueryTranslatorTestCase { @Test @TestForIssue( jiraKey = "HHH-1724" ) + @FailureExpectedWithNewMetamodel public void testCriteriaAggregationReturnType() { Session s = openSession(); s.beginTransaction(); @@ -222,6 +223,7 @@ public class CriteriaHQLAlignmentTest extends QueryTranslatorTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testCountReturnValues() { Session s = openSession(); Transaction t = s.beginTransaction(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/hql/ScrollableCollectionFetchingTest.java b/hibernate-core/src/test/java/org/hibernate/test/hql/ScrollableCollectionFetchingTest.java index ebba1a8dad..0f5277e3ac 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hql/ScrollableCollectionFetchingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/hql/ScrollableCollectionFetchingTest.java @@ -50,7 +50,6 @@ import static org.junit.Assert.fail; * * @author Steve Ebersole */ -@FailureExpectedWithNewMetamodel public class ScrollableCollectionFetchingTest extends BaseCoreFunctionalTestCase { @Override public String[] getMappings() { @@ -148,6 +147,7 @@ public class ScrollableCollectionFetchingTest extends BaseCoreFunctionalTestCase comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" + "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables" ) + @FailureExpectedWithNewMetamodel public void testScrollingJoinFetchesSingleRowResultSet() { Session s = openSession(); Transaction txn = s.beginTransaction(); @@ -274,6 +274,7 @@ public class ScrollableCollectionFetchingTest extends BaseCoreFunctionalTestCase value = DialectChecks.SupportsResultSetPositioningOnForwardOnlyCursorCheck.class, comment = "Driver does not support result set positioning methods on forward-only cursors" ) + @FailureExpectedWithNewMetamodel public void testScrollingJoinFetchesForward() { TestData data = new TestData(); data.prepare(); @@ -306,6 +307,7 @@ public class ScrollableCollectionFetchingTest extends BaseCoreFunctionalTestCase comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" + "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables" ) + @FailureExpectedWithNewMetamodel public void testScrollingJoinFetchesReverse() { TestData data = new TestData(); data.prepare(); @@ -340,6 +342,7 @@ public class ScrollableCollectionFetchingTest extends BaseCoreFunctionalTestCase comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" + "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables" ) + @FailureExpectedWithNewMetamodel public void testScrollingJoinFetchesPositioning() { TestData data = new TestData(); data.prepare(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/hql/WithClauseTest.java b/hibernate-core/src/test/java/org/hibernate/test/hql/WithClauseTest.java index d2a6d53052..4afc535418 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hql/WithClauseTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/hql/WithClauseTest.java @@ -42,7 +42,7 @@ import static org.junit.Assert.fail; * * @author Steve Ebersole */ -@FailureExpectedWithNewMetamodel +//@FailureExpectedWithNewMetamodel public class WithClauseTest extends BaseCoreFunctionalTestCase { @Override public String[] getMappings() { @@ -50,6 +50,7 @@ public class WithClauseTest extends BaseCoreFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testWithClauseFailsWithFetch() { TestData data = new TestData(); data.prepare(); @@ -113,6 +114,7 @@ public class WithClauseTest extends BaseCoreFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testWithClause() { TestData data = new TestData(); data.prepare(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/ImmutableTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/ImmutableTest.java index 2498f9be99..5150e4d369 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/ImmutableTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/immutable/ImmutableTest.java @@ -35,7 +35,6 @@ import org.hibernate.cfg.Environment; import org.hibernate.criterion.Projections; import org.hibernate.dialect.Oracle8iDialect; import org.hibernate.proxy.HibernateProxy; -import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.type.AbstractSingleColumnStandardBasicType; import org.hibernate.type.TextType; @@ -852,7 +851,6 @@ public class ImmutableTest extends BaseCoreFunctionalTestCase { } @Test - @FailureExpectedWithNewMetamodel public void testImmutableCollectionWithUpdate() { clearCounts(); @@ -1074,7 +1072,6 @@ public class ImmutableTest extends BaseCoreFunctionalTestCase { } @Test - @FailureExpectedWithNewMetamodel public void testImmutableCollectionWithMerge() { clearCounts(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/keymanytoone/bidir/embedded/KeyManyToOneTest.java b/hibernate-core/src/test/java/org/hibernate/test/keymanytoone/bidir/embedded/KeyManyToOneTest.java index 612a6586c7..8273a6eadb 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/keymanytoone/bidir/embedded/KeyManyToOneTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/keymanytoone/bidir/embedded/KeyManyToOneTest.java @@ -31,7 +31,6 @@ import org.hibernate.Session; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; import org.hibernate.criterion.Restrictions; -import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.junit.Test; @@ -51,7 +50,6 @@ public class KeyManyToOneTest extends BaseCoreFunctionalTestCase { } @Test - @FailureExpectedWithNewMetamodel public void testCriteriaRestrictionOnKeyManyToOne() { Session s = openSession(); s.beginTransaction(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/legacy/MultiTableTest.java b/hibernate-core/src/test/java/org/hibernate/test/legacy/MultiTableTest.java index b3f8623ca4..f666844304 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/legacy/MultiTableTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/legacy/MultiTableTest.java @@ -28,7 +28,6 @@ import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; -@FailureExpectedWithNewMetamodel public class MultiTableTest extends LegacyTestCase { @Override protected boolean isCleanupTestDataRequired() { @@ -59,6 +58,7 @@ public class MultiTableTest extends LegacyTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testFetchOneToMany() throws Exception { Session s = openSession(); s.beginTransaction(); @@ -69,6 +69,7 @@ public class MultiTableTest extends LegacyTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testNarrow() throws Exception { Session s = openSession(); s.beginTransaction(); @@ -80,6 +81,7 @@ public class MultiTableTest extends LegacyTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testJoins() throws Exception { Session s = openSession(); s.beginTransaction(); @@ -103,6 +105,7 @@ public class MultiTableTest extends LegacyTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testSubclassCollection() throws Exception { //if ( getDialect() instanceof HSQLDialect ) return; //TODO: figure out why!? Session s = openSession(); @@ -194,6 +197,7 @@ public class MultiTableTest extends LegacyTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testQueries() throws Exception { Session s = openSession(); s.beginTransaction(); @@ -220,6 +224,7 @@ public class MultiTableTest extends LegacyTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testConstraints() throws Exception { Session s = openSession(); Transaction t = s.beginTransaction(); @@ -239,6 +244,7 @@ public class MultiTableTest extends LegacyTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testMultiTable() throws Exception { Session s = openSession(); Transaction t = s.beginTransaction(); @@ -377,6 +383,7 @@ public class MultiTableTest extends LegacyTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testMultiTableGeneratedId() throws Exception { Session s = openSession(); Transaction t = s.beginTransaction(); @@ -495,6 +502,7 @@ public class MultiTableTest extends LegacyTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testMultiTableCollections() throws Exception { Session s = openSession(); Transaction t = s.beginTransaction(); @@ -543,6 +551,7 @@ public class MultiTableTest extends LegacyTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testMultiTableManyToOne() throws Exception { Session s = openSession(); Transaction t = s.beginTransaction(); @@ -576,6 +585,7 @@ public class MultiTableTest extends LegacyTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testMultiTableNativeId() throws Exception { Session s = openSession(); Transaction t = s.beginTransaction(); @@ -589,6 +599,7 @@ public class MultiTableTest extends LegacyTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testCollection() throws Exception { Session s = openSession(); Transaction t = s.beginTransaction(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java b/hibernate-core/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java index f7919b044e..ace0447683 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java @@ -51,7 +51,6 @@ import org.hibernate.dialect.SybaseAnywhereDialect; import org.hibernate.dialect.SybaseDialect; import org.hibernate.dialect.TimesTenDialect; import org.hibernate.dialect.function.SQLFunction; -import org.hibernate.testing.FailureExpectedWithNewMetamodel; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -59,7 +58,6 @@ import static org.junit.Assert.assertTrue; @SuppressWarnings( {"UnnecessaryUnboxing", "UnnecessaryBoxing"}) -//@FailureExpectedWithNewMetamodel public class SQLFunctionsTest extends LegacyTestCase { private static final Logger log = Logger.getLogger( SQLFunctionsTest.class ); @@ -217,7 +215,6 @@ public class SQLFunctionsTest extends LegacyTestCase { } @Test - @FailureExpectedWithNewMetamodel public void testBroken() throws Exception { Session s = openSession(); Transaction t = s.beginTransaction(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/onetoone/formula/OneToOneFormulaTest.java b/hibernate-core/src/test/java/org/hibernate/test/onetoone/formula/OneToOneFormulaTest.java index 4f3b3095a5..3bfc166695 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/onetoone/formula/OneToOneFormulaTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/onetoone/formula/OneToOneFormulaTest.java @@ -49,7 +49,6 @@ import static org.junit.Assert.assertTrue; /** * @author Gavin King */ -@FailureExpectedWithNewMetamodel public class OneToOneFormulaTest extends BaseCoreFunctionalTestCase { private static class TextAsMaterializedClobType extends AbstractSingleColumnStandardBasicType { public final static TextAsMaterializedClobType INSTANCE = new TextAsMaterializedClobType(); @@ -77,6 +76,7 @@ public class OneToOneFormulaTest extends BaseCoreFunctionalTestCase { } @Test + @FailureExpectedWithNewMetamodel public void testOneToOneFormula() { Person p = new Person(); p.setName("Gavin King"); diff --git a/hibernate-core/src/test/java/org/hibernate/test/onetoone/optional/OptionalOneToOneTest.java b/hibernate-core/src/test/java/org/hibernate/test/onetoone/optional/OptionalOneToOneTest.java index 3b22cc7acd..3661494b94 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/onetoone/optional/OptionalOneToOneTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/onetoone/optional/OptionalOneToOneTest.java @@ -28,7 +28,6 @@ import org.junit.Test; import org.hibernate.Session; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; -import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import static org.junit.Assert.assertNull; @@ -36,7 +35,6 @@ import static org.junit.Assert.assertNull; /** * @author Gavin King */ -@FailureExpectedWithNewMetamodel public class OptionalOneToOneTest extends BaseCoreFunctionalTestCase { @Override public String[] getMappings() {