how to use Oracle sequence in Hibernate;

i have a sequence created in Oracle;how to use this sequence in Hibernate;i think we have to declare in mapping file;how to declare?



select seq_emp_master.nextval from dual
LVL 20
chaitu chaituAsked:
Who is Participating?
 
JaaxArchitectCommented:
In the hibernate mapping file you should define something like this :
        <id
            name="primaryKeyId"
            column="PRIMARYKEYID"
            type="java.lang.Long"
            unsaved-value="null"
        >
            <generator class="sequence">
                <param name="sequence">NAME_OF_THE_PRIM_KEY_SEQ</param>
            </generator>
        </id>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.