I have a problem when I try to execute a criteria query on the ids of one of my entities.
When doing a
Criteria.list() I can observe only a short date being sent in the select statement (2007-03-23 11:01:00), but I have set a full timestamp object in the criteria (2007-03-23 11:01:00.465465).
I have tried to reduce the information to the essential. I hope I did not strip too much.
This is the code I am using to create the criteria.
Code:
DetachedCriteria c = DetachedCriteria.forClass(Table.class);
c.add(Restrictions.eq("id.akz", new Integer(237601150)));
c.add(Restrictions.eq("id.oid", Timestamp.valueOf("2007-03-23 11:01:00.465465")));
The select statement looks good:
Code:
select
this_.AKZ as AKZ40_0_,
this_.OID as OID2_40_0_,
...
from
SCHEMA.TABLE this_
where
this_.AKZ=?
and this_.OID=?
But the binding of the parameters is strange:
Code:
hibernate.type.IntegerType - binding '237601150' to parameter: 1
hibernate.type.TimestampType - binding '2007-03-23 11:01:00' to parameter: 2
The mapping document for this class contains the following composite key:
Code:
<composite-id name="id" class="TableId">
<key-property name="akz" type="int">
<column name="AKZ" />
</key-property>
<key-property name="oid" type="timestamp">
<column name="OID" length="26" />
</key-property>
</composite-id>
In the POJO of the id, the property
oid has the type of
java.util.Date.
I am running this on a DB2, version 8.2.
I hope somebody can help me with this.