I have a package of classes that all share a common base class Model. The Model implements Serializable and houses a few common values important values:
public class Model implements Serializable
{
long id; // primary key
Timestamp version; // optimistic locking aid
boolean deleted; // "soft" delete
....
}
The property access methods are in the derived models because they have annotations @Id, @Version and @Column for each of these. In a real POJO those accessors would be in the base Model class.
How can I persist base class properties from within the subclass?
Not tried this myself, but I'm assuming you've seen this?:
http://docs.jboss.org/ejb3/app-server/tutorial/singleinheritance/single.html