Author: steve.ebersole(a)jboss.com
Date: 2010-01-09 15:17:47 -0500 (Sat, 09 Jan 2010)
New Revision: 18491
Modified:
core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/BooleanLiteralNode.java
Log:
HHH-4743 - Bug in BooleanLiteralNode with CustomType
Modified:
core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/BooleanLiteralNode.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/BooleanLiteralNode.java 2010-01-09
20:17:01 UTC (rev 18490)
+++
core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/BooleanLiteralNode.java 2010-01-09
20:17:47 UTC (rev 18491)
@@ -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 @@
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();
+ }
}