Announcement Announcement Module
Collapse
No announcement yet.
Cross Package DAO Inheritance Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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;

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

    Comment

    Working...
    X