Hi Michael,
the documentation was apparently changed for 4.0 in 2015 to reflect the current 
behaviour:

https://github.com/apache/cayenne/commit/5bb12cd36f0d87e3b217cdc20c22a0f6dc9613f3#diff-5b9a57288e30ef9855d80a63a812ec4f

Cheers,
- hugi


> On 1. mar. 2017, at 14:59, Michael Gentry <blackn...@gmail.com> wrote:
> 
> 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

Reply via email to