> The same Bean have an other column which is auto generated from an other sequence which is manually managed
The first question is why I'd say.
Long Background:
Way way back in the day I was an Oracle guy (as in worked and breathed Oracle database) and it was "Sequences are the BEST !!!!" back then ... but there are some important details and things have changed since then.
Sequences have a lightweight lock associated with them - at Oracle we called it a latch. That is, getting the next value of a sequence has some concurrency overhead. So somes rules of thumb wrt sequences:
1) Never use the same sequence for multiple tables. I've seen some folks use the same sequence for ALL their tables - this is a really really really BAD idea.
2) insert ... () values (myseq.nextval, ?, ...) ... isn't really great as we hit that latch for each and every insert which could impact our insert speed and cost.
Sequences as I see them from an Oracle perspective were designed to have a decent INCREMENT BY like say 100. A client could then with 1 myseq.nextval get 100 values that the client could then use. We pay the latch cost once and get 100 id values that the client can then happily use without any extra cost.
So when we see insert statements with myseq.nextval in them we feel is not ideal per say from a latch cost perspective. It is especially not ideal on a table that we really want to do lots of batch inserting into / big fast growing tables with lots of inserts etc.
Now, it's ok if the client is a persistence library or ORM etc to deal with these INCREMENT BY 100 type sequences holding the unused values etc but otherwise they are actually a bit of a PITA for application code to deal with ... and hence over time that leads us to 2023 where now "IDENTITY IS THE BEST !!!" and every database today pretty much makes IDENTITY really nice to use and as performant as SEQUENCES except for MS SQL Server. Specifically MS SQL Server does not support GetGeneratedKeys on batched inserts !!!!!! so that pushes the preference for MS SQL Server back to SEQUENCE. This is kind of an ironic twist is that Oracle and MS SQL Server have traded places in terms of IDENTITY vs SEQUENCES.
Now also note that decent databases have a IDENTITY CACHE option that is a bit like INCREMENT BY to reduce that latch cost. If we are using IDENTITY on a table that we want to do a lot of inserts into then look to use a CACHE option on IDENTITY. So the DDL will look like:
create table audit_log (
id bigint generated by default as identity (start with 1000 cache 100) not null,
description varchar(255),
modified_description varchar(255),
constraint pk_audit_log primary key (id)
);
--------------------
Back to the question ...
What we can do with Ebean is have an id column populated via IDENTITY or SEQUENCE and then have another column as a UUID populated by UUID generation. This is relatively expected.
To have a second column populated by another sequence isn't support or expected. I don't actually see the utility value in a second SEQUENCE being used on the same table - that is something I don't understand and I'd love to know you are doing that.
Cheers, Rob.