Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [eclipselink-users] Lifecycle methods (or how do I default columnvalues)

Hi Tim,

@PrePersist works in my project very well. Maybe you are using merge? Than
you have to use @PreUpdate.

Kind regards,

> -----Original Message-----
> From: eclipselink-users-bounces@xxxxxxxxxxx 
> [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of 
> Tim Hollosy
> Sent: Friday, May 02, 2008 8:45 PM
> To: EclipseLink User Discussions
> Subject: [eclipselink-users] Lifecycle methods (or how do I 
> default columnvalues)
> I was reading the Toplink annotation spec and noticed the @PrePersist
> method annotation, I took this to mean it would be called before
> persisting, so I could put things like default values in there.
> However, it was never called. So my question is - does EclipseLink not
> implement the Lifecycle callbacks? I didn't see much mention of them
> in the wiki.
> My more basic question is -- what's the correct way to set default
> values. In my case I want to call a framework method  pull the user id
> from the app and set it on a createdBy field. This only needs to occur
> on insert, so a hacky sort of way to do it would be to override the
> getter and if the value's null then set it to the value from elsewhere
> in the app, but I think that solution kind of smells bad.
> -- 
> ./tch
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx

Back to the top