cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <>
Subject Re: PK conflicts when inserting complex graphs
Date Fri, 04 Aug 2017 19:05:16 GMT
You do need to make sure that the database's sequence "Increment by"
value matches Cayenne's expected sequence increment (m).

You have to pick the same value to use in both places.

On Fri, Aug 4, 2017 at 11:26 AM, Musall, Maik <> wrote:
> I think I've found the main reason why this isn't working with Cayenne-generated PKs.
Cayenne will fetch the next sequence value n, and then use up to n+m values for inserts before
requesting a new one, but the sequence will only be incremented by 1. So, when the app is
shut down at this point and restarted, it will fetch a value from the sequence that is already
used. I think Cayenne would have to set the new sequence value to whatever it's pk cache size
is for that strategy, but it doesn't.

View raw message