Sequence Generation

Hi,

I’m trying to use the Sequence Generation in my project but i really need some help. Gone through the documentation but still no luck. Here’s what i’ve done so far. I think i’m over looking something but i don’t know what.

image

And in the editor i’ve done this.

image

As you can see, the getNextValue is grayed out and i get the message getNextValue is never used.

Please some help would be welcome.

Regards,

LS

Anyone, any idea?

Hello, LloydS

But you getNextValue() method is really not used anywhere in the code.

I suggest you use the getNextNumber() method of the UniqueNumbersService in your editor screen:

@Inject
private UniqueNumbersService uniqueNumbersService;

@Subscribe
protected void onBeforeCommit(BeforeCommitChangesEvent event) {
    if (PersistenceHelper.isNew(getEditedEntity())) {
        getEditedEntity().setMyNumber(uniqueNumbersService.getNextNumber("mySequence"));
    }
}

Best regards,
Mariya

Thanks Mariya,

BIG help. Many thanks.

Regards,

LS