-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Dates mapping with stored procedure
PostPosted: Tue Jul 04, 2006 5:30 am 
Newbie

Joined: Tue Jul 04, 2006 4:03 am
Posts: 2
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]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 04, 2006 7:43 am 
Newbie

Joined: Tue Jul 04, 2006 4:03 am
Posts: 2
The error comes from the hibernate.cfg.xml where the property "date format" was incorrect. ("dateformat" in place of "date format".


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.