1 Reply Latest reply on Jul 16, 2004 3:36 AM by Dan Avram

    Oracle sequence - ClassCastException

    Dan Avram Newbie

      Hi all,

      I'm trying to configure JBoss (3.2.0) to use Oracle sequences for my CMP PKs. I have followed both "unknown-pk" and "known pk" paths, they both end up in the same wall.

      I prefer the known pk solution, therefore I designated my Pk as java.lang.Long, I have configured the necessary pk-sql as entity-command, and the select is called successfully by JBoss. Still, before inserting the CMP's fields in the DB, when JBoss is checking whether the entity already exists, I have a ClassCastException, thrown because the PreparedStatement is expecting a Long parameter, and the fetched Pk is java.math.BigDecimal (!).

      I don't have the stacktrace handy right now, I'll post it later. But has anyone already fought with this problem ? Basically, why does a SELECT someSequence.NEXTVAL FROM DUAL return a JDBC-TYPE of DECIMAL ?

      Thank you for any hints on what am I doing wrong.

      Dan