1

im trying to get the currval from a sequence, this is what i have:

Please notice, that im already calling SEQUENCE.nextval before the SEQUENCE.currval in the same Hibernate session

Hibernate Mapping File:

    <id column="SYSTEM_VERSION_ID" name="systemVersionId">
        <generator class="sequence">
            <param name="sequence">SEQ_SYSTEM_VERSIONS</param>
            <param name="value_column">curr_val</param>
        </generator>
    </id>

I thought curr_val or currval as value_column will do the trick but no, it keeps performing nextval and printing: Hibernate: select SEQ_SYSTEM_VERSIONS.nextval from dual.

Victor Elizondo
  • 275
  • 1
  • 4
  • 20
  • there are many similar questions on SO, see http://stackoverflow.com/questions/4843490/get-from-oracle-sequence-with-hibernate – harsh Nov 11 '13 at 06:14
  • 1
    @harsh , Victor's question is looking for an answer of how to get CURRENT sequence value and link you shared describes how to get NEXT sequence value. Please consider removing the link or change wordings of your post accordingly. – Dark Knight Nov 11 '13 at 06:19
  • I need CURRVAL, please dont post NEXTVAL thanks @DarkKnight – Victor Elizondo Nov 11 '13 at 06:26
  • @DarkKnight The link states that `Getting the next (nextval) or current (currval) value from a sequence is typically done using a select.`, I think the approach described in this would help in Victor's question. Another similar approach @ http://stackoverflow.com/questions/10210273/how-to-retrieve-the-current-value-of-an-oracle-sequence-without-increment-it – harsh Nov 11 '13 at 06:30
  • @harsh thanks for updating with new link. – Dark Knight Nov 11 '13 at 06:33
  • I think that helps but im trying to find out if it exists a way to do this in my generator – Victor Elizondo Nov 11 '13 at 06:33

0 Answers0