Oracle Sequence in CDT

There is a table which is using oracle sequence as a PK. I am using below annotations in XSD, the problem here is all the EMP_IDs creating in jumbling order like (1,2,3,4,13,14,5,6).

<xsd:element name="EMP_ID" type="xsd:integer">
<xsd:annotation>
<xsd:appinfo source="appian.jpa">@Id @Column(name="EMP_ID", columnDefinition="NUMBER NOT NULL") @SequenceGenerator(name="EMP_ID_SEQ_generator", sequenceName="EMP_ID_SEQ", initialValue=1) @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="EMP_ID_SEQ_generator")</xsd:appinfo>
</xsd:annotation>
</xsd:element>

OriginalPostID-248506

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    @anilkumark Did you come across through any scenario where, while inserting rows some error occurred, Because as you are using sequence, once that is got executed successfully or not but it's value used to get increase. Before inserting a record in DB first Hit the following query in Oracle DB
    ============================
    sequence.CURRVAL
    ============================
    And observe whats your current value of your Sequence on Oracle Console, then try inserting a record in DB using Appian, and observe did you get the Correct Primary Key (Next One). This generally cause when the Sequence gets invoke improper

    If this do not work out, then try Creating trigger on top of Your Sequence

    Hope this Will help You
Reply
  • 0
    Certified Lead Developer
    @anilkumark Did you come across through any scenario where, while inserting rows some error occurred, Because as you are using sequence, once that is got executed successfully or not but it's value used to get increase. Before inserting a record in DB first Hit the following query in Oracle DB
    ============================
    sequence.CURRVAL
    ============================
    And observe whats your current value of your Sequence on Oracle Console, then try inserting a record in DB using Appian, and observe did you get the Correct Primary Key (Next One). This generally cause when the Sequence gets invoke improper

    If this do not work out, then try Creating trigger on top of Your Sequence

    Hope this Will help You
Children
No Data