cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Using SequenceGenerator in code

Using SequenceGenerator in code

Hi, all.

I need to use SequenceGenerator for WTPart in java code.

I have tried setNumber(SequenceGenerator.generateValue("WTPARTID_seq")) but result was not i expected to see.

Now i am trying setNumber(SequenceGenerator.generateValue("{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:10:0}")) but it throws SQLServerException: Index 1 out of range.

Can anyone give me working sample?

Thanks.

4 REPLIES 4

Re: Using SequenceGenerator in code

Hi,

Try this PersistenceHelper.manager.getNextSequence("WTPARTID_seq");

or this

EnterpriseHelper.getNumber(new Object[]{"{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:10:0}"});

Thanks,

Kaushik

Re: Using SequenceGenerator in code

Hi Kaushik,

Since the getNextSequence(String str) method is deprecated, is it safe to use this API method?

Thanks

Srini

Re: Using SequenceGenerator in code

Hi Srinivas,

Yes the API you mentioned it's deprecated.

But the other one which I mentioned

EnterpriseHelper.getNumber(new Object[]{"{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:10:0}"});

is not deprecated so you can use that.

The OOTB code internally using getNextSequence so it may b safe.

Thanks,

Kaushik

Re: Using SequenceGenerator in code

Thanks Kaushik!

Announcements