hibernate sequence [Closed]

This topic contains 8 replies, has 4 voices, and was last updated by  mamatha.vijay 12 years, 3 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #218738 Reply

    Andrew Cheng
    Participant

    I insert a record to the Oracle table through Hibernate
    , however, it come out sequence error.
    I have seen the problem posted from others.
    My question is that why I need sequence here if I do not define
    any sequence in Hibernate definition file. My table have five columns
    with VARCHAR, I do not use any sequence.

    🙁

    try
    {
    session = SessionFactory.currentSession();
    session.save(u);
    session.flush();
    // AC
    SessionFactory.closeSession();
    }

    – SQL Error: 2289, SQLState: 42000
    – ORA-02289: sequence does not exist

    – SQL Error: 2289, SQLState: 42000
    – ORA-02289: sequence does not exist

    – Could not save object
    java.sql.SQLException: ORA-02289: sequence does not exist

    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:579)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1894)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:831)
    at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2496)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2840)

    #218739 Reply

    Riyad Kalla
    Member

    Have a look at this thread, it covers the same problem. Hopefully it will help: http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-4523-highlight-ora02289.html

    #218800 Reply

    Andrew Cheng
    Participant

    I know you want me refer that. I saw that before I posted this question.
    The case is different
    they define sequence in hibernate-mapping, so Hibernate complain about not found. I DO NOT define
    sequence in hibernate-mapping. I never need it in the Oracle database. ALL my table columns are VARCHAR. NO Sequence needed.

    #218801 Reply

    Andrew Cheng
    Participant

    <hibernate-mapping package=”com.aeris.hibernate”>

    <class name=”AersysCspUsers” table=”AERSYS_CSP_USERS”>
    <id name=”email” column=”EMAIL” type=”java.lang.String”>
    <generator class=”native” />
    </id>

    <property name=”password” column=”PASSWORD” type=”java.lang.String” />
    <property name=”firstname” column=”FIRSTNAME” type=”java.lang.String” not-null=”true” />
    <property name=”lastname” column=”LASTNAME” type=”java.lang.String” not-null=”true” />
    <property name=”accountId” column=”ACCOUNT_ID” type=”java.lang.Long” not-null=”true” />
    <property name=”aerisRole” column=”AERIS_ROLE” type=”java.lang.String” not-null=”true” />
    </class>

    </hibernate-mapping>

    #218807 Reply

    Riyad Kalla
    Member

    This really is a Hibernate question, I don’t know the intracacies of it so I can’t tell you why it would be trying to use a sequence when accessing Oracle. If you do get a good reply, we only ask that you post the solution back here for others.

    #219354 Reply

    Andrew Cheng
    Participant

    please close

    #268720 Reply

    mateo3646
    Member

    I had the same problem, but the point was in my XML configuration Archive of my POJO…

    You Should change the generator class to : INCREMENT, if you table’s id is like AUTOINCREMENT.

    <!– Key(Pojo) vs Key(Table)–>
    <id name=”idPaciente” column=”idpaciente” type=”java.lang.Integer”>
    <generator class=”increment”/>
    </id>

    Saludos desde la Cd mas Linda del MUNDO

    #279717 Reply

    If you are using
    <generator class=”native”> and oracle as backend
    then you should create a sequence called hibernate.sequence in oracle because natve generator takes sequence to generate values.

    To create a sequence in oracle.
    create sequence hibernate.sequence;
    commit;

    Mamatha

    #279718 Reply

    ooops its
    ********************
    hibernate_sequence
    ********************
    thank You

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: hibernate sequence [Closed]

You must be logged in to post in the forum log in