Hi Hugi, If validateForInsert() is being called before PrePersist, we have a disconnect between the documentation and the behavior you are seeing:
"PrePersist: right before a new object is committed, inside ObjectContext.commitChanges() and ObjectContext.commitChangesToParent() (and prior to validateForInsert())." What version of Cayenne are you using? I wonder if something has changed or if the documentation is just wrong. Thanks, mrg On Wed, Mar 1, 2017 at 6:18 AM, Hugi Thordarson <h...@godurkodi.is> wrote: > Hi all, > I have some logic in a Listener that uses @PrePersist to populate the > value of a required attribute before committing changes. Turns out this > doesn’t work, since Cayenne invokes validateForInsert() before running > @PrePersist. > > Any suggestions for where I can invoke logic populates required values > before validation? > > Cheers, > - hugi