[jpa-spec users] [jsr338-experts] clarification about use of "immediately" word in describing 3.6.1 Automatic Validation Upon Lifecycle Events

From: Scott Marlow <>
Date: Fri, 20 Apr 2012 11:39:47 -0400

I'm exactly sure how the word "immediately" applies in section 3.6.1,
where we describe when the validation will happen after lifecycle events.

If the application calls EntityManager.persist() and then calls
EntityManager.flush(). Then sometime later the jta transaction commits.
  What if the pre-persist is triggered as part of em.persist() but the
validation happens during em.flush or commit (before completion)?

How does the term "immediately" apply in this context and why is that a

Current text from 2.1:
3.6.1 Automatic Validation Upon Lifecycle Events

This specification supports the use of bean validation for the automatic
validation of entities upon the pre-persist, pre-update, and pre-remove
lifecycle validation events. These lifecycle validation events occur
immediately after the point at which all the PrePersist, PreUpdate, and
PreRemove lifecycle callback method invocations respectively have been
completed, or immediately after the point at which such lifecycle
callback methods would have been completed (in the event that such
callback methods are not present).

In the case where an entity is persisted and subsequently modified in a
single transaction or when an entity is modified and subsequently
removed in a single transaction, it is implementation dependent as to
whether the pre-update validation event occurs. Portable applications
should not rely on this behavior.