Class AbstractEntityEntry

    • Method Detail

      • getEntityKey

        public EntityKey getEntityKey()
        Description copied from interface: EntityEntry
        Get the EntityKey based on this EntityEntry.
        Specified by:
        getEntityKey in interface EntityEntry
        Returns:
        the EntityKey
      • postUpdate

        public void postUpdate​(Object entity,
                               Object[] updatedState,
                               Object nextVersion)
        Description copied from interface: EntityEntry
        Handle updating the internal state of the entry after actually performing the database update. Specifically we update the snapshot information and escalate the lock mode
        Specified by:
        postUpdate in interface EntityEntry
        Parameters:
        entity - The entity instance
        updatedState - The state calculated after the update (becomes the new loaded state.
        nextVersion - The new version.
      • postDelete

        public void postDelete()
        Description copied from interface: EntityEntry
        After actually deleting a row, record the fact that the instance no longer exists in the database
        Specified by:
        postDelete in interface EntityEntry
      • postInsert

        public void postInsert​(Object[] insertedState)
        Description copied from interface: EntityEntry
        After actually inserting a row, record the fact that the instance exists on the database (needed for identity-column key generation)
        Specified by:
        postInsert in interface EntityEntry
      • requiresDirtyCheck

        public boolean requiresDirtyCheck​(Object entity)
        Description copied from interface: EntityEntry
        Not sure this is the best method name, but the general idea here is to return true if the entity can possibly be dirty. This can only be the case if it is in a modifiable state (not read-only/deleted) and it either has mutable properties or field-interception is not telling us it is dirty. Clear as mud? :/ A name like canPossiblyBeDirty might be better
        Specified by:
        requiresDirtyCheck in interface EntityEntry
        Parameters:
        entity - The entity to test
        Returns:
        true indicates that the entity could possibly be dirty and that dirty check should happen; false indicates there is no way the entity can be dirty
      • isModifiableEntity

        public boolean isModifiableEntity()
        Description copied from interface: EntityEntry
        Can the entity be modified? The entity is modifiable if all of the following are true:
        • the entity class is mutable
        • the entity is not read-only
        • if the current status is Status.DELETED, then the entity was not read-only when it was deleted
        Specified by:
        isModifiableEntity in interface EntityEntry
        Returns:
        true, if the entity is modifiable; false, otherwise,
      • serialize

        public void serialize​(ObjectOutputStream oos)
                       throws IOException
        Description copied from interface: EntityEntry
        Custom serialization routine used during serialization of a Session/PersistenceContext for increased performance.
        Specified by:
        serialize in interface EntityEntry
        Parameters:
        oos - The stream to which we should write the serial data.
        Throws:
        IOException - If a stream error occurs
      • setCompressedValue

        protected <E extends Enum<E>> void setCompressedValue​(AbstractEntityEntry.EnumState<E> state,
                                                              E value)
        Saves the value for the given enum property.
        Parameters:
        state - identifies the value to store
        value - the value to store; The caller must make sure that it matches the given identifier
      • getCompressedValue

        protected <E extends Enum<E>> E getCompressedValue​(AbstractEntityEntry.EnumState<E> state)
        Gets the current value of the given enum property.
        Parameters:
        state - identifies the value to store
        Returns:
        the current value of the specified property
      • setCompressedValue

        protected void setCompressedValue​(AbstractEntityEntry.BooleanState state,
                                          boolean value)
        Saves the value for the given boolean flag.
        Parameters:
        state - identifies the value to store
        value - the value to store
      • getCompressedValue

        protected boolean getCompressedValue​(AbstractEntityEntry.BooleanState state)
        Gets the current value of the given boolean flag.
        Parameters:
        state - identifies the value to store
        Returns:
        the current value of the specified flag