Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Questions regarding SessionEventListener and EntityManager.flush()

Hello everyone,

I've got two questions regarding the SessionEventListener concept
and flushing the entity manager (either explizit or implicit).

1. Shouldn't RepeatableWriteUnitOfWork.writeChanges() also call the getEventManager().preCommitUnitOfWork()?
so that a SessionEventListener has a change to intercept this call ?
Otherwise it is not directly possible to intercept an EntityManager flush().
This is even more difficult if the flush is implicit (e.g. before executing a query)

2.
Case 1:
Imagine that some managed entities got changed, and a flush() will be (successfully) executed. Will the changeset of further flush() calls (or even a transaction commit) contain those entities again, or will they be removed in the changeset which is "delivered" through the SessionEvent?

Case 2:
And to how will the changeset look in the following situation:
1. a new entity will be persisted
2. flush() will be called, changeset contain the entity, marked as "new".
3. this entity will now be changed by the application
4. flush()/transaction commit will be invoked.
5. how does the changeset (in the preCommitUnitOfWork() event) look like? is the entity still marked as "new"?

Best regards,
Patric




Back to the top