diff --git a/core/src/main/java/org/hibernate/hql/ast/tree/BooleanLiteralNode.java b/core/src/main/java/org/hibernate/hql/ast/tree/BooleanLiteralNode.java index 9fbe2dd647..5961f2419d 100644 --- a/core/src/main/java/org/hibernate/hql/ast/tree/BooleanLiteralNode.java +++ b/core/src/main/java/org/hibernate/hql/ast/tree/BooleanLiteralNode.java @@ -24,8 +24,8 @@ */ package org.hibernate.hql.ast.tree; +import org.hibernate.type.LiteralType; import org.hibernate.type.Type; -import org.hibernate.type.BooleanType; import org.hibernate.Hibernate; import org.hibernate.QueryException; import org.hibernate.engine.SessionFactoryImplementor; @@ -42,33 +42,37 @@ public class BooleanLiteralNode extends LiteralNode implements ExpectedTypeAware return expectedType == null ? Hibernate.BOOLEAN : expectedType; } - public BooleanType getTypeInternal() { - return ( BooleanType ) getDataType(); - } - public Boolean getValue() { return getType() == TRUE ? Boolean.TRUE : Boolean.FALSE; } /** - * Expected-types really only pertinent here for boolean literals... - * - * @param expectedType + * {@inheritDoc} */ public void setExpectedType(Type expectedType) { this.expectedType = expectedType; } + /** + * {@inheritDoc} + */ public Type getExpectedType() { return expectedType; } + /** + * {@inheritDoc} + */ public String getRenderText(SessionFactoryImplementor sessionFactory) { try { - return getTypeInternal().objectToSQLString( getValue(), sessionFactory.getDialect() ); + return typeAsLiteralType().objectToSQLString( getValue(), sessionFactory.getDialect() ); } catch( Throwable t ) { throw new QueryException( "Unable to render boolean literal value", t ); } } + + private LiteralType typeAsLiteralType() { + return (LiteralType) getDataType(); + } }