I have fields which are available in all domain objects. Those fields are:
Created_By
Created_Date
Modified_By
Modified_Date
Can I declare/have CoreBusinessObject which contains these four fields and extend this into another object? Is it good design? If so, how could I do the ORM mapping?
I’d recommend following design….
First, you need a LifeCycleInfo component….
The LifeCycleInfo stores information related to when the Persistent Model instance was created, last modified, deleted and archived.
Then, you need a marker interface say, Auditable
Then, your Persistent Model implements Auditable
Then, you need Hibernate Interceptor …
}
Then, register your Auditable Interceptor…..
You’re Done!
EDIT:
Employee.java