Re: JPA identity : primary-key unicity violated


Thanks for your help. I looked at these logs. 

To clearly identify the id value, I made ids really different in the tables (multiply per 10, 100, ...) and reindexed the sequence table and add 100 to each value.

This seems to solve the situation but I don't know why that table was desynchronized.
I quickly looked at the code. It looks very good, obtain sequence values in synchronized block (I guess the locked ValueGenerator is a singleton) and the block reserved in db put a lock.

I can't check statically, but for concurrency and performances, it could be good to reserve the sequence value in a (short) dedicated db connection.
Does DN do it (regardless of connection pool, JTA, ...) ? I mention this because the application hang from time to time when I have some long tx running  and I don't know why yet.


Join to automatically receive all group messages.