Hibernate version: 3.2.0
Name and version of the database you are using: Oracle 9i
I'm having problems using a serializable in the where clause of an HQL statement. My HQL statement is:
Code:
from service.valueobjects.AttributeVO attribute where attribute.value = :value
where the value parameter is being set to an arbitrary java.lang.Serializable.
When I execute the query, I get a
Code:
ORA-00997: illegal use of LONG datatype
SQL exception back.
The actual SQL being generated is as follows:
Code:
select attributev0_.id as id0_, attributev0_.name as name0_, attributev0_.value as value0_, attributev0_.group_definition_id as group4_0_ from Attribute attributev0_ where attributev0_.value=?
This seems to be where the problem lies - the concept of equals for a Serializable is not implemented in the underlying database - it has to be tested in the Java layer. The documentation (
http://www.hibernate.org/hib_docs/refer ... ryhql.html) is silent on the subject of what types can and can't be used in where clause expressions. Am I right in assuming that this use is unsupported? Is my best option to retrieve all the persisted AttributeVO object, and then perform an equality test on the value property myself?
For reference, here is the mapping for the AttributeVO class:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="service.valueobjects">
<class name="AttributeVO" table="Attribute" lazy="false">
<id name="id" column="id" type="long" access="field">
<generator class="sequence">
<param name="sequence">attribute_id_seq</param>
</generator>
</id>
<property name="name" type="string" length="255" not-null="false" lazy="false"/>
<property name="value" type="serializable" not-null="false" lazy="false"/>
<many-to-one name="groupDefinition" column="group_definition_id" class="GroupDefinitionVO" not-null="true"/>
</class>
</hibernate-mapping>