This discussion is archived
4 Replies Latest reply: Nov 12, 2012 2:23 PM by codigoadf RSS

pb Insertion DBSequence value  programmatically

fakhri.kharrat Newbie
Currently Being Moderated

I try to insert a record that have a DBSequence Primary key programmatically ,

so I create a method in AppModuleImp
public oracle.jbo.domain.Number getDBSequencenumber(String sequenceName){
oracle.jbo.server.SequenceImpl theSeq = new oracle.jbo.server.SequenceImpl(sequenceName, getDBTransaction());
oracle.jbo.domain.Number seqNextNumber = theSeq.getSequenceNumber();
return seqNextNumber;
catch (Exception e){
//handle exceptions
return null;

after that I initiate it in a bean,

public oracle.jbo.domain.Number getNextBonSRTSequenceNumber() {
BindingContext bindingContext = BindingContext.getCurrent();
BindingContainer bindings = bindingContext.getCurrentBindingsEntry();
OperationBinding getNextSequence = bindings.getOperationBinding("getDBSequencenumber");
getNextSequence.getParamsMap().put("sequenceName", "OFFRE_SEQ");
oracle.jbo.domain.Number seqVal = (oracle.jbo.domain.Number)getNextSequence.execute();
return seqVal;

and in my ViewRowImp Class I have a method that accept the sequence value and use setter method :

public void convertQuoteToSale(oracle.jbo.domain.Number vcdsrt) {

DBSequence seqcdSRT = new DBSequence((oracle.jbo.domain.Number)vcdsrt);

// insert data


public void createBonSRT(DBSequence seqcdSRT) {

EntityDefImpl bonSrtDef = BonSrtImpl.getDefinitionObject();
BonSrtImpl newBonSRT = (BonSrtImpl)bonSrtDef.createInstance2(getDBTransaction(), null);



try {
} catch (Exception e) {


in the last bold text mark the value of the sequence is for example 30 and it's correct  but the value inserted in the database was different !!!!

I don't know why the value inserted was different.

in my case i have to insert other data that depend on this primary key

thank for helping me


  • Correct Answers - 10 points
  • Helpful Answers - 5 points