Hibernate Tools : how to generate base classes? -
i installed eclipse helios , hibernate tools 3.4.0.beta1.
i've been trying generate "base class" mapping files can't find out how do. let have mapping file called individual.hbm.xml. want hibernate tools generate 2 pojos : - baseindividual.java contain constructors , getters/setters - individual.java add "custom" code not removed whenever re-generate pojos
i spent lot of time seeking information never found practical answer. if can help... in advance
i have come across question while trying same thing myself (i think).
what have done set following in hbm.xml config file:
<class name="user" table="users"> <meta attribute="generated-class">ocs.authentication.userbase</meta> <id name="user_id" column="user_id" type="integer"> <generator class="increment"/> </id> <property name="username" column="username" type="string" /> </class>
note <meta attribute="generated-class">
section. cause generated class called userbase (in case). can create class (called user example) extend base class:
public class user extends userbase { public user() { } public void somefunction() { ... } }
this seems working me. hope useful you, or others wanting similar thing.
Comments
Post a Comment