E
- entity typepublic class EntityPersistingEvent<E extends Entity>
extends org.springframework.context.ApplicationEvent
implements org.springframework.core.ResolvableTypeProvider
You can use @EventListener
annotation on a bean method to handle this event. The handler works inside
the transaction which is going to persist the entity. The entity instance is in the NEW state.
Example of event handler:
@Component("test_OrderPersistingListener") public class OrderPersistingListener { @EventListener protected void orderPersisting(EntityPersistingEvent<Order> event) { Order order = event.getEntity(); //... } }
Constructor and Description |
---|
EntityPersistingEvent(java.lang.Object source,
E entity)
INTERNAL.
|
Modifier and Type | Method and Description |
---|---|
E |
getEntity()
Returns entity to be persisted, in the NEW state.
|
org.springframework.core.ResolvableType |
getResolvableType()
INTERNAL.
|
java.lang.String |
toString() |
public EntityPersistingEvent(java.lang.Object source, E entity)
public E getEntity()
public org.springframework.core.ResolvableType getResolvableType()
getResolvableType
in interface org.springframework.core.ResolvableTypeProvider
public java.lang.String toString()
toString
in class java.util.EventObject