Control over lifecycle of persisted Entities
Connected to my thoughts about A portfolio for Enterprise Web Applications I am thinking about developing (= providing a well tested, bundled and documented software feature with minimal coding effort) a mechanism which is capable of the following
- Log all persisted states of an Entity inside the Database – always including Information about Action Type, Time and User/Process
- Allow also forthcoming states to be saved as such an “inactive” Entity state (meaning “to be activated later”).
- Allow for Action Types the Database Operations (C)reate, (R)ead, (U)pdate, (D)elete *and* (A)ctivate (the right to activate a Database changing Operation) to be defined as Rights a User/Process may have on a Class of Entities.
- Allow each such User Right on an Entity Class to be restricted by a (custom) Right Condition.
- Provide Out of The Box a Right Condition allowing a User to (A)ctivate only if the Operation to be activated was not done by the activating User himself (”Second Set of Eyes” Feature)
- Allow for Ability to activate not just forthcoming, but also every old “inactive” Entity State. (”Entity Rollback” Feature)
I want to do this based on Java while making use of JPA/Hibernate simply because these ideas are about leveraging preexisting project experience and knowledge. To be further investigated is the Usage of
- Hibernate Interceptors for Logging Entity State change
- Hibernate XML API also for Logging
- (Hibernate) Bean Validator Framework for CRUD and Activation Rights and mentioned Custom Conditions

