Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

My this method does not give Gap-less sequence no.Can any body help to get gapless seq.no by this me

TAJDINAug 31 2015 — edited Sep 9 2015

Sir

My these method does not give Gap-less sequence no.Can any body help to get gapless seq.no by these methods?

public oracle.jbo.domain.Number getFirstSeqNumber(String seq\_name){

      SequenceImpl seq=new SequenceImpl(seq\_name, getDBTransaction());   

      return seq.getSequenceNumber();          

}  

public void newVoucher(ActionEvent actionEvent) {

        // Add event code here...

        BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();        

        DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("CpvVoucherView1Iterator");        

        RowSetIterator rsi = dciter.getRowSetIterator();        

        Row lastRow = rsi.last();        

        int lastRowIndex = rsi.getRangeIndexOf(lastRow);        

        Row newRow = rsi.createRow();                               

        newRow.setNewRowState(Row.STATUS\_NEW);        

        rsi.insertRowAtRangeIndex(lastRowIndex +1, newRow);         

        rsi.setCurrentRow(newRow);       

       oracle.jbo.domain.Number vid = getFirstSeqNumber("CPV\_VOUCHER\_ID\_SEQ");   

       java.util.Date date = new java.util.Date();  

       java.util.Calendar cal = java.util.Calendar.getInstance();  

       cal.setTime(date);  

       int month = cal.get(Calendar.MONTH) + 1;  

       java.text.DecimalFormat df = new java.text.DecimalFormat("0000");  

       String val = "CVP" + String.valueOf(month) + df.format(vid.intValue());  

       newRow.setAttribute("VoucherId", val);                         

        }

I study the Anderjus blog http://andrejusb.blogspot.com/2013/01/how-to-implement-gapless-sequence-in.html

seq-1.png

and

seq-2.png

This link is very useful to get gap-less seq no but I want to this approach in my above methods.

How can I adopt Anderjus recommended methods Create() nad doDML() methods in my above two methods.

Regards

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 7 2015
Added on Aug 31 2015
9 comments
325 views