Sequence Generation

Hi community,

I want to have a field for an entity, which will be always incremented, when Instance is added.
How I have to use the sequence generation? Or are there some examples to archieve this?
Because I dont know, where I have to implement this.
Also if I do have to modify db scripts for it.

Thanks a lot

Assuming that you’re not talking about a primary key then I think the easiest way is to use an EntityListener:

for changing filling in the field every time a new instance is saved. To generate the actual number – I think we might have covered that here: