Results 1 to 2 of 2

Thread: Cross Package DAO Inheritance

  1. #1
    Join Date
    Jul 2007
    Posts
    6

    Default 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. #2
    Join Date
    Jul 2007
    Posts
    6

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •