Class EntityPersistenceEvent

  • Direct Known Subclasses:
    EntityDeleteEvent, EntityNewEvent, EntityUpdateEvent

    public class EntityPersistenceEvent
    extends Object
    The base event object send out to reflect a persistence event on an entity (save, update, delete, etc.). Note: it is possible to directly access/retrieve the object which is being deleted or persisted. To update the object's state one should NOT call setters directly on that object. Instead use the setCurrentState(Property, Object) method.
    • Constructor Detail

      • EntityPersistenceEvent

        public EntityPersistenceEvent()
    • Method Detail

      • getCurrentState

        public Object getCurrentState​(Property property)
        Get the current value (which will be persisted) for a certain property.
      • getCurrentState

        public Object[] getCurrentState()
        The current values of the properties of the entity, these values are persisted. Use the getPropertyNames() to see which properties are located where in this array.
        See Also:
      • getPropertyNames

        public String[] getPropertyNames()
        The names of the properties of the entity which are persisted. The array corresponds to the types and state arrays.
        See Also:
        getTypes(), getCurrentState()
      • getTargetInstance

        public BaseOBObject getTargetInstance()
        the target instance of the event, note that depending on the event it it not correct to directly update the instance, use the api's offered by the specific subclass of the EntityPersistenceEvent class.
      • setCurrentState

        public void setCurrentState​(Property property,
                                    Object value)
        Change the value/state of a property. The change will also be passed on to the entity and to the database (in case of update and save events).
        property - the property to change
        value - its new value
      • isStateUpdated

        public boolean isStateUpdated()
        true if the state of the entity was updated/changed, false otherwise.
      • getId

        public String getId()
        The id of the entity being persisted, can be null for new entities.
      • getTypes

        public org.hibernate.type.Type[] getTypes()
        The type definition of the properties of the entity to be persisted.
        See Also: