1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Hibernate & Oracle - ERROR JDBCExceptionReporter:78 - ORA-02289: sequ

Discussion in 'SQL PL/SQL' started by raju11, Oct 9, 2014.

  1. raju11

    raju11 Guest

    I am trying to insert a record to the Oracle table through Hibernate. I am getting the following error message.


    These are the objects i have created in oracle database by coneccting with user 'Rita'

    1)Creation of table ‘READING’
    ----------------------------

    create table Maller.READING(
    ID NUMBER(15) primary key,
    SITE_ID VARCHAR2(15),
    ACCUMULATED FLOAT,
    CREA_DATE DATE,
    PROC NUMBER(1));

    Table created.

    Created READING table in maller schema.



    2)Creation of a sequence READING_SEQ
    ------------------------------------

    Create sequence READING_SEQ
    start with 1000000001
    increment by 1;

    Sequence created

    3)Creation of a trigger 'READING_TRI' on a 'READING' table
    -----------------------------------------------------------

    CREATE OR REPLACE TRIGGER READING_TRI
    BEFORE INSERT
    ON Maller.READING
    REFERENCING NEW AS NEW
    FOR EACH ROW
    BEGIN
    SELECT READING_SEQ.nextval INTO :NEW.ID FROM dual;
    END;
    /

    Trigger created


    4) Rita user has the following access rights.

    select * from user_sys_privs;


    USERNAME PRIVILEGE ADM
    ------------------------------ ---------------------------------------- ---
    Rita CREATE OPERATOR NO
    Rita CREATE ANY PROCEDURE NO
    Rita DROP ANY TABLE NO
    Rita CREATE ANY TRIGGER NO
    Rita CREATE PROCEDURE NO
    Rita ALTER ANY TABLE NO
    Rita CREATE SESSION NO
    Rita CREATE SEQUENCE NO
    Rita INSERT ANY TABLE NO
    Rita SELECT ANY TABLE NO
    Rita CREATE ANY INDEXTYPE NO
    Rita CREATE ANY INDEX NO
    Rita UNLIMITED TABLESPACE NO
    Rita CREATE TABLE NO
    Rita CREATE INDEXTYPE NO
    Rita CREATE TYPE NO
    Rita DELETE ANY TABLE NO
    Rita CREATE TRIGGER NO
    Rita CREATE CLUSTER NO
    Rita CREATE ANY TABLE NO

    5) We have granted the following rights to 'maller' and 'rita' after the error message we got.

    As the Rita user we ran:

    GRANT all on READING_SEQ to maller;

    As the maller user we ran:
    GRANT all on READING to Rita ;

    6)Here strange thing is I am able to insert a record in a READING table from oracle database by simply writing 'Insert' query in sqlplus client window, But it was not working from hibernet getting the following error message

    ERROR JDBCExceptionReporter:78 - ORA-02289: sequence does not exist

    I don't know what i am missing out here.

    I would be very thankful to you if anyone provide the solution

    Thanks once again.
     
  2. rajenb

    rajenb Forum Expert

    Messages:
    361
    Likes Received:
    114
    Trophy Points:
    655
    Location:
    Mauritius
    Re: Hibernate & Oracle - ERROR JDBCExceptionReporter:78 - ORA-02289: sequ

    Hi Raju,

    I suppose you're accessing the database (Java oracle connection) with user id=Rita ?
    Anyway, from the detailed steps you described, it looks like you solved the issue on Oracle's side as you clearly stated:

    And given that :
    I suspect the issue comes rather from Hibernate :confused:

    Am not an expert in this area and this might not be the appropriate forum.

    A quick google gives numerous posts resembling your issue; try to have a look at this one:
    http://stackoverflow.com/questions/18081331/hibernate-oracle-sequence-not-working
    http://stackoverflow.com/questions/13282847/sequence-does-not-exist

    HTH.
     
  3. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,347
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    Re: Hibernate & Oracle - ERROR JDBCExceptionReporter:78 - ORA-02289: sequ

    You are missing a synonym for the sequence, I suspect.