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.
|