HHH-10070 - Deprecate use of "collection properties" in HQL

This commit is contained in:
Steve Ebersole 2015-08-31 21:02:09 -05:00
parent 24901af4d9
commit d85fd04eb0
2 changed files with 10 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import org.hibernate.hql.internal.NameGenerator;
import org.hibernate.hql.internal.antlr.HqlSqlTokenTypes; import org.hibernate.hql.internal.antlr.HqlSqlTokenTypes;
import org.hibernate.internal.CoreLogging; import org.hibernate.internal.CoreLogging;
import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.log.DeprecationLogger;
import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.param.ParameterSpecification; import org.hibernate.param.ParameterSpecification;
import org.hibernate.persister.collection.CollectionPropertyMapping; import org.hibernate.persister.collection.CollectionPropertyMapping;
@ -385,6 +386,7 @@ class FromElementType {
// this is hacky, but really this is difficult to handle given the current codebase. // this is hacky, but really this is difficult to handle given the current codebase.
if ( persister != propertyMapping ) { if ( persister != propertyMapping ) {
// we want the subquery... // we want the subquery...
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfCollectionPropertiesInHql( path, fromElement.getClassAlias() );
return getCollectionPropertyReference( path ).toColumns( tableAlias ); return getCollectionPropertyReference( path ).toColumns( tableAlias );
} }
} }

View File

@ -177,4 +177,12 @@ public interface DeprecationLogger {
"See Hibernate Domain Model Mapping Guide for details." "See Hibernate Domain Model Mapping Guide for details."
) )
void deprecatedTableGenerator(String generatorImpl); void deprecatedTableGenerator(String generatorImpl);
@LogMessage(level = WARN)
@Message(
id = 90000016,
value = "Found use of deprecated 'collection property' syntax in HQL/JPQL query [%2$s.%1$s]; " +
"use collection function syntax instead [%1$s(%2$s)]."
)
void logDeprecationOfCollectionPropertiesInHql(String collectionPropertyName, String alias);
} }