When you have the concept of "draftable" entities, that is entities that need to be in a draft state before going live, the OpenEntityManagerInViewFilter causes some strange behavior.
If you have a controller that queries an entity and then you change that entity it will automatically flush at the end of the transaction. Your changes are then persisted even though you may not want them to be. Detaching the object doesn't seem to help in some cases.
Could this be a bad design and a misuse of JPA persistence or is it just something that has to be dealt with while using OpenEntityManagerInViewFilter?
Draftable draftableObject = draftService.loadPossiblyFromDraft(id);
draftableObject.setName("Test");
//Only trying to save the changes as a draft object and not affect the original
draftService.saveAsDraft(draftableObject);
//After the request ends with OpenEntityManagerInViewFilter enabled
//The draftableObject changes are persisted to the entity as well as the draft.