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)

An update, it's just not being called on my Mappedsuperclass, if I put
it in the actual entity it is called?

Is this by design or should I file a bug report?

On Mon, May 5, 2008 at 3:33 PM, Tim Hollosy <hollosyt@xxxxxxxxx> wrote:
> I think I may be running into - bug 224416
>  (https://bugs.eclipse.org/bugs/show_bug.cgi?id=224416)
>
>  Is there some setting you have to do in order to get lifecycle stuff
>  to work? Is it dependent on weaving maybe?
>
>  I'm not really sure of a work-around at this time for doing things
>  like setting default values. So any help would be appreciated.
>
>  Thanks,
>  Tim
>
>
>
>  On Fri, May 2, 2008 at 5:53 PM, Mathias Walter <mathias.walter@xxxxxxx> wrote:
>  > Hi Tim,
>  >
>  >  @PrePersist works in my project very well. Maybe you are using merge? Than
>  >  you have to use @PreUpdate.
>  >
>  >  --
>  >  Kind regards,
>  >  Mathias
>  >
>  >
>  >
>  >  > -----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
>  >  > https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>  >
>  >  _______________________________________________
>  >  eclipselink-users mailing list
>  >  eclipselink-users@xxxxxxxxxxx
>  >  https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>  >
>
>
>
>  --
>  ./tch
>



-- 
./tch


Back to the top