javahibernatehbm2java

Class inheritance with Hibernate and hbm2java


I am generating my domain objects from my hbm files with hbm2java and now I want them to all inherit a base class. This class will have some utility methods for dealing with listeners. It does not really need to be persisted and I am hoping that I would not have to do a hbm file for it since it will be abstract and only have methods. Is there a meta tag or something to have all generated class extend another class?

Or is this such a lame design that it simply cannot be done with hibernate?


Solution

  • I remember doing this way back. See this: http://docs.jboss.org/tools/2.1.0.Beta1/hibernatetools/html_single/#d0e4159

    Basically you want to use a meta tag here with attribute extends for a common base class or implements for a common base interface.