Announcement Announcement Module
No announcement yet.
Cross Package DAO Inheritance Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cross Package DAO Inheritance

    Hi all,

    I have a parent base class with its respective DAO and hibernate mapping file all compiled and packaged in a jar. I'm now using that library and want to create a derivative object from the previously packaged parent. Normally I'd use <joined-subclass> within the parent hibernate mapping file, but since it's a library (explicitly meant to be generic) it cannot be modified.

    Is it possible to map the relationship (specifically the DAO classes) without having direct access to modify the parent hibernate mapping file? If not, can it be done programmatically? Thanks!

  • #2
    Figured it out... and I have to say it's pretty damn slick. My derivative class's mapping file looks like this;

    <hibernate-mapping package="com.mycompany.flaky.dao">
    	<joined-subclass name="FlakyMember" table="FLAKY_MEMBER" schema="FLAKY" extends="">
    		<key column="MEMBER_ID"/>
            <property name="networkRole" type="java.lang.Long">
                <column name="NETWORK_ROLE" precision="22" scale="0" not-null="true" />
            <property name="graduationYear" type="java.lang.Long">
                <column name="GRADUATION_YEAR" precision="5" scale="0" not-null="true" />
    It's great when stuff works