Skip to main content

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

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.


Back to the top