Hi,
I' ve problem with mapping dates using a stored procedure to load objects from DB.
The DB field is a date in format *iso (DB2 ISeries V5R3). When i call
the query with this code,
Code:
Session s = HibernateUtil.getSessionFactory().getCurrentSession();
Transaction t = s.beginTransaction();
Query personQuery = s.getNamedQuery("Query_01");
personQuery.setParameter(0, new Long("21"));
List prestationsList = personQuery.list();
i've got wrong values in the date (1954-12-20 in place of 2006-05-21 in DB).
Thanks for help.
Here is the hbm file :
<class name="Person" table="PERSON">
<id name="id" column="id">
<generator class="native"></generator>
</id>
<discriminator column="perstype" type="string"></discriminator>
<property name="name" column="name"></property>
<property name="creationDate" type="date">
<column name="credate" sql-type="date" > </column>
</property>
<subclass discriminator-value="E" name="Employee">
<property name="department" column="department"></property>
</subclass>
<loader query-ref="Query_01" />
</class>
<sql-query name="Query_01" callable="true">
<return alias="person" class="Person">
<return-discriminator column="perstype" />
<return-property name="id" column="id"></return-property>
<return-property name="name" column="name"></return-property>
<return-property name="department" column="department"></return-property>
<return-property name="creationDate" column="credate"></return-property>
</return>
{call SP_PERSON(?)}
</sql-query>
Code:
[/list]