Auto Increment id in MySQL to a sequence id in Oracle Issue
posted 4 years ago
I originally started testing hibernate using MySQL. I got it to work but now that I moved it to Oracle. I can't get the insertion to the database to generate the id. It keeps adding/updating an user with id = 0.
This is the error that I'm getting: Caused by: java.sql.SQLException: Invalid column type: getInt not implemented for class oracle.jdbc.driver.T4CRowidAccessor
This was my getId() - This worked in MySQL.
This is the trigger I have in Oracle
CREATE OR REPLACE TRIGGER "CHS"."USERS_TRG" BEFORE INSERT ON USERS
FOR EACH ROW
IF :NEW.USERID IS NULL THEN
SELECT USERS_SEQ.NEXTVAL INTO :NEW.USERID FROM DUAL;
What should I change to now make it work in Oracle?