HHH-10122 - Deprecate ".class" property-style entity-type-expression format

This commit is contained in:
Steve Ebersole 2015-09-30 00:06:37 -05:00
parent 3cdc447654
commit e64d028306
2 changed files with 14 additions and 0 deletions

View File

@ -14,8 +14,10 @@ import org.hibernate.hql.internal.ast.util.ASTUtil;
import org.hibernate.hql.internal.ast.util.ColumnHelper; import org.hibernate.hql.internal.ast.util.ColumnHelper;
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.StringHelper; import org.hibernate.internal.util.StringHelper;
import org.hibernate.persister.collection.QueryableCollection; import org.hibernate.persister.collection.QueryableCollection;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.Queryable; import org.hibernate.persister.entity.Queryable;
import org.hibernate.sql.JoinType; import org.hibernate.sql.JoinType;
@ -198,8 +200,13 @@ public class DotNode extends FromReferenceNode implements DisplayableNode, Selec
if ( isResolved() ) { if ( isResolved() ) {
return; return;
} }
Type propertyType = prepareLhs(); // Prepare the left hand side and get the data type. Type propertyType = prepareLhs(); // Prepare the left hand side and get the data type.
if ( parent == null && AbstractEntityPersister.ENTITY_CLASS.equals( propertyName ) ) {
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfClassEntityTypeSelector( getLhs().getPath() );
}
// If there is no data type for this node, and we're at the end of the path (top most dot node), then // If there is no data type for this node, and we're at the end of the path (top most dot node), then
// this might be a Java constant. // this might be a Java constant.
if ( propertyType == null ) { if ( propertyType == null ) {

View File

@ -186,4 +186,11 @@ public interface DeprecationLogger extends BasicLogger {
"use collection function syntax instead [%1$s(%2$s)]." "use collection function syntax instead [%1$s(%2$s)]."
) )
void logDeprecationOfCollectionPropertiesInHql(String collectionPropertyName, String alias); void logDeprecationOfCollectionPropertiesInHql(String collectionPropertyName, String alias);
@LogMessage(level = WARN)
@Message(
id = 90000017,
value = "Found use of deprecated entity-type selector syntax in HQL/JPQL query ['%1$s.class']; use TYPE operator instead : type(%1$s)"
)
void logDeprecationOfClassEntityTypeSelector(String path);
} }