[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [eclipselink-users] EclipseLink JpaEntityManager with JBoss Seam
|
Mathias,
I searched as well and could not find this in the documentation or JavaDocs. I will file a bug to get this addressed.
Here is a simple example of using a SessionEventListener with postCacaluclateUnitOfWorkChanges. The 'magic' is in the fact that the change-set is available as a property of the event passed in:
public static class AccessUOWChangeSet extends SessionEventAdapter {
@Override
public void postCalculateUnitOfWorkChangeSet(SessionEvent event) {
UnitOfWorkChangeSet uowCS = (UnitOfWorkChangeSet) event
.getProperty("UnitOfWorkChangeSet");
System.out.println("UnitOfWorkChangeSet with "
+ uowCS.getAllChangeSets().size() + " changes and "
+ uowCS.getDeletedObjects().size() + "deleted objects");
for (Iterator i = uowCS.getAllChangeSets().values().iterator(); i
.hasNext();) {
ObjectChangeSet ocs = (ObjectChangeSet) i.next();
if (ocs.isNew()) {
System.out.println("\tINSERT: " + ocs.getClassName()
+ ocs.getPrimaryKeys());
} else {
System.out.println("\tUPDATE: " + ocs.getClassName()
+ ocs.getPrimaryKeys());
}
}
}
}
To configure the usage of the event listener you will need to use the eclipselink.session-event-listener property to pass in the class name of your listener. It is documented here:
http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%29#Using_EclipseLink_JPA_Extensions_for_Session.2C_Target_Database_and_Target_Application_Server
Doug
-----Original Message-----
From: Mathias Walter [mailto:mathias.walter@xxxxxxx]
Sent: Tuesday, July 15, 2008 6:55 AM
To: EclipseLink User Discussions
Subject: RE: [eclipselink-users] EclipseLink JpaEntityManager with JBoss
Seam
Hi again,
> The short story though for JpaEntityManager usage and access
> top the final change-set for a transaction is that the event
> mechanism is what you need to use.
I could not find much about SessionEventListener and how to enable it. Are
there any examples/docs (except API docs)? And how to enable it with
persistence.xml?
I don't use the EclipseLink Workbench.
The EclipseLink doc says:
How to Use Events and Listeners
Information pending
:(
--
Regards,
Mathias
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users