chanaporn temaismithi

Greenhorn
+ Follow
since Aug 11, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by chanaporn temaismithi

i have tried long and int too but same problem, saved value was wrong -> error when read back.
Hi,

I tried to save very simple value to oracle by using sequence as my id generator. I stepped thru the object value and confirmed that my id field is obtained correctly from the sequence but when hibernate save the object to database somehow the id field turns out to be some funny value and when reading it back i got this error

java.lang.ArrayIndexOutOfBoundsException: -124
at oracle.sql.LnxLibThin.lnxnuc(LnxLibThin.java:6036)
at oracle.sql.NUMBER.toInt(NUMBER.java:412)
at oracle.jdbc.dbaccess.DBConversion.NumberBytesToInt(DBConversion.java:2884)

I did try to use long type but also get this error
java.sql.SQLException: Overflow Exception
at oracle.sql.NUMBER.toLong(NUMBER.java:376)
at oracle.jdbc.dbaccess.DBConversion.NumberBytesToLong(DBConversion.java:2915)

This is my mapping:

<class name="de.gloegl.road2hibernate.Event" table="EVENTS">
<id name="id" column="id" type="integer">
<generator class="sequence">
<param name="sequence">event_sequence</param>
</generator>
</id>
<property name="date" column="eventdate" type="timestamp"/>
<property name="title" column="eventtitle"/>
</class>

The same code works just fine with HSQL or by reading the prepopulated value from oracle. Is there anything I did wrong?

Thank you,
CT