-->
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.  [ 1 post ] 
Author Message
 Post subject: Issues using java.math.BigDecimal and java.sql.TimeStamp
PostPosted: Tue Jul 27, 2004 2:15 pm 
Beginner
Beginner

Joined: Thu Jul 22, 2004 8:09 am
Posts: 20
Hi,
I have 2 issues with different data types.
Q1: I have an ID column in the database defined as a NUMBER. I used Middlegen-Hibernate-r5 to generate the .hbm.xml files and hbm2java to generate the POJOs

<id
name="id"
type="java.math.BigDecimal"
column="ID"
>
<generator class="native" />
</id>

I cannot do this as <generator class="native" /> returns a long,int or short.. does this mean that I have to change all my config files manually from BigDecimal to long? Is there a workaround?

Q2: Also, I have another column defined as DATE in the database. config files have it as :
<property
name="hcdrd"
type="java.sql.Timestamp"
column="HCDRD"
length="7"
/>
The POJO generated using hbm2java puts it as java.util.Date. I get an exception when I try to select some rows from the database using this configuration. If I go back and change the java.sql.Timestamp to java.util.Date, everything works fine. Do I have to do this manually in all my files for the Date columns?

Thanks.


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

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.