Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [eclipselink-users] EclipseLink JpaEntityManager with JBoss Seam


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 {

		public void postCalculateUnitOfWorkChangeSet(SessionEvent event) {
			UnitOfWorkChangeSet uowCS = (UnitOfWorkChangeSet) event

			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);

				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:


-----Original Message-----
From: Mathias Walter []
Sent: Tuesday, July 15, 2008 6:55 AM
To: EclipseLink User Discussions
Subject: RE: [eclipselink-users] EclipseLink JpaEntityManager with JBoss

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
I don't use the EclipseLink Workbench.

The EclipseLink doc says:

How to Use Events and Listeners
Information pending 



eclipselink-users mailing list

Back to the top