I ended up just setting pkCacheSize in my pkgenerator constructor. It actually makes more sense there than as a configuration value because it can never use the cache because it just doesn't work.
Rob > On 11 Feb 2026, at 15:53, Robert A. Decker <[email protected]> wrote: > > I'm on 4.2.1 > > There seems to be some bugginess between JdbcPkGenerator and > MySQLPkGenerator, where JdbcPkGenerator will generate a batch of pks but > MySQLPkGenerator only increments the value in the pk cache table by 1 instead > of by 20 or whatever the cache is. This happens when I override > MySQLPkGenerator.getLongPrimaryKey in my own pk generator, but I don't see > anything in MySQLPkGenerator.getLongPrimaryKey where it's supposed to update > the pk table by the cache size... I pretty much just copied the code from > MySQLPkGenerator.getLongPrimaryKey so that I could change the table name. > > Anyway, I could be completely wrong about the bugginess - I haven't confirmed > it by running code without my subclass and I'm only going by what I see in > the source code. > > What I really need to know is how I can set the JdbcPkGenerator.pkCacheSize > value to 1 (or 0) so that I don't have any caching of pks (I have multiple > systems/codebases using the same database). > > I don't see any way to do it in the DataSourceBuilder while building the > cayenne runtime. Do I have to do it in my pkgenerator subclass? > > Rob
