Joined: Tue Dec 28, 2004 7:41 pm Posts: 7
|
I'm trying to do a like search for a property that is a Long and I can't seem to figure out what needs to be done. Even after stripping all the properties other than the primary key the following results in a ClassCastException
Criteria criteria = session.createCriteria(SomeClass.class);
criteria.setMaxResults(MAX_RESULTS);
criteria.add(Expression.like("someId", "%234140"));
I'm able to sucessfully query fine with Expression.eq but I would like to do a like query.
-Eric
Hibernate version:
2.1
Name and version of the database you are using:
Oracle 9i
Mapping documents:
<id name="someId"
type="java.lang.Long"
column="SOME_ID"
>
<generator class="assigned" />
</id>
Full stack trace of any exception that occurs:
java.lang.ClassCastException
at net.sf.hibernate.type.LongType.set(LongType.java:32)
at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:48)
at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:35)
at net.sf.hibernate.loader.Loader.bindPositionalParameters(Loader.java:749)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:788)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:265)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:118)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3613)
at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
|
|