Hibernate version:3.2
I have a table in which the ID is a string of length 3. When I attempt to read a record based on the ID the record is not found (null is returned).
I know the record is there because:
1.) When I use Hibernate to get a list of all the records in the table I see the one I am looking for
2.) When I cut and past the Hibernate generated SQL into SQL Plus the querry works!
Any ideas?
code:
Code:
public static ReviewStatusType findById(Session hSession, String Id)
throws HibernateException {
ReviewStatusType reviewStatusType = null;
try {
Criteria crit = hSession.createCriteria(ReviewStatusType.class);
crit.add(Expression.eq("reviewStatusTypeId", Id));
reviewStatusType = (ReviewStatusType) crit.uniqueResult();
} catch (HibernateException he) {
throw (he);
}
return reviewStatusType;
}
Mapping documents:
<id name="reviewStatusTypeId" type="string">
<column name="REVIEW_STATUS_TYPE_ID" length="3" />
<generator class="assigned" />
</id>
Name and version of the database you are using:Oracle 10g
The generated SQL (show_sql=true):
select this_.REVIEW_STATUS_TYPE_ID as REVIEW1_85_0_, this_.NAME as NAME85_0_, this_.LAST_UPDATE_USERID as LAST3_85_0_, this_.LAST_UPDATE_TS as LAST4_85_0_, this_.SORT_SEQUENCE as SORT5_85_0_
from CWNS2008.REVIEW_STATUS_TYPE this_
where this_.REVIEW_STATUS_TYPE_ID=?