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

Mathias,

After the commit of a transaction the JpaEntityManager has its transaction context (UnitOfWork) reset so that developers can continue working with the EntityManager. If you look at using a SessionEventListener you can get a callback during the UnitOfWork commit cycle to access the change-set.

Doug

-----Original Message-----
From: Mathias Walter [mailto:mathias.walter@xxxxxxx]
Sent: Monday, July 14, 2008 6:16 AM
To: EclipseLink User Discussions
Subject: RE: [eclipselink-users] EclipseLink JpaEntityManager with JBoss
Seam


> Ah, I was thinking getCurrentChanges...

So you don't know why it is null?

> 
> ./tch
> 
> 
> On Mon, Jul 14, 2008 at 1:57 AM, Mathias Walter 
> <mathias.walter@xxxxxxx> wrote:
> > Hi,
> >
> >> If you just committed wouldn't it make sense for the 
> change set to be
> >> empty/null?
> >
> > according to the doc of UnitOfWork:
> >
> > public UnitOfWorkChangeSet getCurrentChanges()
> > ADVANCED: This method Will Calculate the chages for the 
> UnitOfWork. Without
> > assigning sequence numbers
> > This is a Computationaly intensive operation and should be 
> avoided unless
> > necessary. A valid changeSet, with sequencenumbers can be 
> collected from the
> > UnitOfWork After the commit is complete by calling
> > unitOfWork.getUnitOfWorkChangeSet()
> >
> > AND
> >
> > public UnitOfWorkChangeSet getUnitOfWorkChangeSet()
> > ADVANCED: Returns the currentChangeSet from the UnitOfWork. 
> This is only
> > valid after the UnitOfWOrk has commited successfully.
> >
> > I do not use UnitOfWork explicit. I do tx = em.getTransaction(),
> > em.merge(entity) and then tx.commit(). em.getUnitOfWork() 
> returns the
> > UnitOfWork in this way also. But why is the 
> UnitOfWorkChangeSet null?
> >
> > In the log I can see that only the changed fields of the 
> entity are included
> > in the update SQL statement. So the changeset is calculated.
> >
> > How to access it?
> >
> > --
> > Regards,
> > Mathias
> >
> >>
> >> ./tch
> >>
> >>
> >> On Sun, Jul 13, 2008 at 3:45 PM, Mathias Walter
> >> <mathias.walter@xxxxxxx> wrote:
> >> > Hi,
> >> >
> >> > I can call entityManager.getDelegate() which returns the 
> EclipseLink
> >> > JpaEntityManager. Unfortunatelly,
> >> getUnitOfWork().getUnitOfWorkChangeSet()
> >> > returns null after commit.
> >> >
> >> > How can I get the UnitOfWorkChangeSet? Do I have to enable
> >> something else?
> >> >
> >> > --
> >> > Regards,
> >> > Mathias
> >> >
> >> >> -----Original Message-----
> >> >> From: eclipselink-users-bounces@xxxxxxxxxxx
> >> >> [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of
> >> >> Mathias Walter
> >> >> Sent: Sunday, July 13, 2008 10:03 AM
> >> >> To: 'EclipseLink User Discussions'
> >> >> Subject: [eclipselink-users] EclipseLink JpaEntityManager
> >> >> with JBoss Seam
> >> >>
> >> >>
> >> >> Hi,
> >> >>
> >> >> I'm using JBoss Seam and EclipseLink together. Now I want to
> >> >> access the
> >> >> ObjectChangeSets.
> >> >> But they are only accessable via the
> >> >> org.eclipse.persistence.jpa.JpaEntityManager and not via
> >> >> javax.persistence.EntityManager or via the Seam injected
> >> >> org.jboss.seam.persistence.EntityManagerProxy.
> >> >>
> >> >> Does anyone how to access the JpaEntityManager from Seam or
> >> >> configure Seam
> >> >> to use the JpaEntityManager instead of EntityManagerProxy?
> >> >>
> >> >> --
> >> >> Kind regards,
> >> >> Mathias
> >> >>
> >> >> _______________________________________________
> >> >> 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
> >> >
> >> _______________________________________________
> >> 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
> >
> _______________________________________________
> 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


Back to the top