Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
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.
Hi,
Try this PersistenceHelper.manager.getNextSequence("WTPARTID_seq");
or this
EnterpriseHelper.getNumber(new Object[]{"{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:10:0}"});
Thanks,
Kaushik
Hi Kaushik,
Since the getNextSequence(String str) method is deprecated, is it safe to use this API method?
Thanks
Srini
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
Thanks Kaushik!