AssociationValueEntry entity has id field annotated with @GeneratedValue without any parameters (AssociationValueEntry) which means that the AUTO strategy is selected. In combination with Postgres db it means that actually SEQUENCE strategy is selected. That creates a sequence with a default increment value of 50. Hibernate uses a pooled optimization strategy by default with allocationSize 50 which causes it to ask the database about nextval from the sequence and next values increment by itself until exceeds allocationSize then asks the database for a next val from the sequence again.
It is a good optimization in a standard environment but dangerous in a multitenant environment because e.g. imagine the first operation triggered by tenant1 causes retrieving nextval from tenant1 sequence then the next operation is in triggered by tenant2 and hibernate will not ask db again for nextval from sequence because not used allocationSize pool. That can cause a problem with the uniqueness of primary keys.
The other thing is that if hibernate optimization is disabled in configuration and sequence increment size is changed to 1 and the service uses schema validation then another issue can happen (if it will be changed in one service and others will remain the same).
The sequence can be invalidated in case if we have many axon services that use the same database but different schemas. Hibernate uses naive validation - gets all sequences from the database (from all schemas) and puts them to a map where a key is just a sequence name which is the same in that case in all schemas so they are overridden. So at the end, it can compare entity with sequence from different service (schema)
Hibernate - DatabaseInformationImpl
I think that the definition should be changed which at least should cause there will be no optimization used so all the time next val is taken from the database.
But actually, probably it would be better to not use sequence idis at all and instead use e.g. UUID