cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <blackn...@gmail.com>
Subject Re: Validation and @PrePersist
Date Wed, 01 Mar 2017 14:59:25 GMT
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 <hugi@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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message