Hi Martin,

This is an interesting approach. I'll probably use it.

I've used the lifecycle event annotations with Toplink/glassfish, and
they're really nice because you know they'll always get called. But, I
suppose this will have to do.

Thanks.

Greg


Martin Homik wrote:
> 
> I use Hibernate as persistence framework, but just declaring a class as an
> Entity Listener and a method to do pre persistence does not work.
> Hibernate's annotation documentation doesn't say anything about how to
> apply lifecycle events in this case. I'm lacking the knowledge how to
> that. 
> 
> Meanwhile, Franco Ferndandes submitted to me answers on his post,
> basically saying that "experts recommended that I do not rely on this
> method only because it is not portable between diff JPA providers. So you
> would actually do this create a stub method prepersist () in base and call
> it in save() and then for every descendant just override your
> prepersist()."
> 
> Martin
> 
> 
> 
> gederer wrote:
>> 
>> I just read that the lifecycle event annotations only work in conjunction
>> with an EntityManager. I'm using Hibernate for persistence. Can anyone
>> say whether this works with JPA?
>> 
>> Thanks!
>> 
>> Greg
>> 
>> 
>> Martin Homik wrote:
>>> 
>>> Can anyone tell how to use Entity Listeners in AppFuse? I ran into the
>>> same problems as already mentioned in 
>>> http://www.nabble.com/forum/ViewPost.jtp?post=11144501&framed=y&skin=2369
>>> this thread . Unfortunately, nobody posted any solution and I'd like to
>>> pick up that topic.
>>> 
>>> In my case I want to use @PrePersist to assign correct date values. If
>>> the date field is annotated with "nullable=false" then a
>>> DataIntegrityViolationException is thrown. If I set nullable to true and
>>> run a DAO test then I can see that the date field is never set which
>>> would mean that the EntityListener is never triggered. 
>>> 
>>> Maybe something in a configuration file has to be set? Any idea?
>>> 
>>> Thanks a lot,
>>> Martin
>>> 
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Entity-Listener-tf4594510s2369.html#a13224818
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to