From cd2c07d3a5cc493b9a3f26322f4e53f7084479e5 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Mon, 31 Aug 2015 21:02:09 -0500 Subject: [PATCH] HHH-10070 - Deprecate use of "collection properties" in HQL (cherry picked from commit d85fd04eb0c1f3a4e7ba16de511455ccb7e61a31) --- .../hibernate/hql/internal/ast/tree/FromElementType.java | 2 ++ .../org/hibernate/internal/log/DeprecationLogger.java | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/FromElementType.java b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/FromElementType.java index 30d69c2e2e..48da3d4810 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/FromElementType.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/FromElementType.java @@ -20,6 +20,7 @@ import org.hibernate.hql.internal.NameGenerator; import org.hibernate.hql.internal.antlr.HqlSqlTokenTypes; import org.hibernate.internal.CoreLogging; import org.hibernate.internal.CoreMessageLogger; +import org.hibernate.internal.log.DeprecationLogger; import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.param.ParameterSpecification; 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. if ( persister != propertyMapping ) { // we want the subquery... + DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfCollectionPropertiesInHql( path, fromElement.getClassAlias() ); return getCollectionPropertyReference( path ).toColumns( tableAlias ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java b/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java index 1513b29dc0..debdbf353b 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java @@ -177,4 +177,12 @@ public interface DeprecationLogger { "See Hibernate Domain Model Mapping Guide for details." ) 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); }