Hi,

The JPA specification defines several listeners which can be configured via
orm.xml or annotations in your entity classes. Here's a quick view of the
available listeners :
The following annotations are defined to designate lifecycle event callback
methods of the corresponding
types.
• PrePersist
• PostPersist
• PreRemove
• PostRemove
• PreUpdate
• PostUpdate
• PostLoad

Section 3.5 of the JPA 1.0 specification covers how these listeners are used
in more detail.

Do you need a listener for any other lifecycle event for your entity, or
does this cover everything you need?

-mike

On Wed, Mar 4, 2009 at 2:02 AM, is_maximum <[email protected]> wrote:

>
> Hi
>
> First I don't know why there is no useful document on these sort of
> listeners and how to use it.
>
> Second after toiling I was able to find dirty fields and fire the
> pre-update
> event. This is for a logging service we have to implement for our
> application but now the problem is that if you want to listen to an
> store-event (pre-update, pre-delete ...) you need to cast the em into
> openjpa-em and then add your listener to it. First I did it in
> @PostConstruct callback method but soon I found that this method will be
> called once each time the container instantiate my stateless so after that
> the listener won't work at all.
>
> now I have implemented some save() update() and delete() method as DAO
> interface and before each method I add this listener to.
>
> The problem is that I think this way of adding listeners is not correct.
> I've already used Hibernate and they have a simple XML file in which you
> can
> simply define your desired listeners and they are guaranteed to work each
> time a CRUD operation being applied
> Is there anythink like that in OpenJPA or Do we need to open an issue in
> JIRA and request such feature?
>
> thanks
> --
> View this message in context:
> http://n2.nabble.com/regarding-StoreListener-tp2420847p2420847.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>

Reply via email to