[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.rt.eclipselink] Re: Persistence context lost after rollback

Could you explain this a bit detailed?

The extended EM keeps a list of every merge, removed or persisted entity. Then upon commit it simply loops over the actions and re-executes them. So it will actually do a "em.persist(e)". Eclipselink will make in memory copies and try to persist those. If that fails, you get an exception and then usually the administration of the entities is out of sync; e.g. some of the entities may already have a new versionnr assigned. Now, if you make changes to these entities and then attempt to persist them again, that will fail. However, the original entities, registered by the extended EM, have not been changed. Therefor you can simply make the change and call commit again. Which the will do the "em.persist(e)" again and an new attempt is made.

I've been using this in production for almost a year now. Works flawlessly.

Tom