HibernateDoclet: problem generating mapping for 'table per class' hierarchy

"Marco Mistroni" <[email protected]> Mon, 20 Nov 2006 15:47:54 +0000
Newsgroups gmane.comp.java.xdoclet.user
Message-ID <[email protected]>
hi all,
 i am using xdoclet plugin (1.2) for maven2.
i have two classes where one extends the other

i am trying to generate mapping files for 'table per class' hierarchy ...
and below are my sample classes

/**
 * @hibernate.class
 *         table="transferrecord"
 *
 * @hibernate.discriminator column="interfaceType"
 *
*/
public abstract class TransferRecordImpl  {

    private java.sql.Date creationTimestamp;
    private int recordNumber;
    private int status;
    private String dlfSiteRef;
    private int transmissionNumber;
    private java.sql.Date transmissionTimestamp;
    private int interfaceType;
    private String warehouseSiteRef;
    private String recordKey;
    /**
     * @see com.waersystems.mw.dto.TransferRecord#getCreationTimestamp()
     */
    public java.sql.Date getCreationTimestamp() {
        return creationTimestamp;
    }

    /**
      * @hibernate.id  generator-class="increment"
      *           column="recordNumber"
      *                 unsaved-value="0"
      * @return the id
     */
    public int getRecordNumber() {
        return recordNumber;
    }

    /**
     * @hibernate.property
     * @see com.waersystems.mw.dto.TransferRecord#getStatus()
     */
    public int getStatus() {
        return status;
    }

    /**
     * @hibernate.property
     * @see com.waersystems.mw.dto.TransferRecord#getTargetSiteRef()
     */
    public String getDlfSiteRef() {
        return dlfSiteRef;
    }

    /**
     * @hibernate.property
     * @see com.waersystems.mw.dto.TransferRecord#getTransmissionNumber()
     */
    public int getTransmissionNumber() {
        return transmissionNumber;
    }

/**
     * @hibernate.property
     * @return
     */
    public int getInterfaceType() {
        return interfaceType;
    }
.......


And then i have this class

/**
 * hibernate.subclass
 *                table="transferrecord"
 *                discriminator-value="0"
 *
*/
public class ReplenRequest extends TransferRecordImpl {

    private String  locationRef;
    private String recordKey;
    private boolean manualInd;
    private String operatorRef;
    private String productRef;
    private String scanDate;
    private String scanner;
    private String scanTime;
    private boolean stockOutInd;
    private boolean valid = false;
    private boolean validHeader = false;
    private final static int INTERFACE_TYPE = 0;

    /**
     * Emtpy constructor. Used during
     * xml2j mapping
     *
     */
    public ReplenRequest() {}



    /**
     * @hibernate.property
     * Method isManualInd.
     * @return
     */
    public boolean isManualInd() {
        return manualInd;
    }


but all  that xdoclet generates is this

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
>
    <class
        name="com.myapp.hibernate.TransferRecordImpl"
        table="transferrecord"
    >

        <id
            name="recordNumber"
            column="recordNumber"
            type="int"
            unsaved-value="0"
        >
            <generator class="increment">
              <!--
                  To add non XDoclet generator parameters, create a file
named
                  hibernate-generator-params-TransferRecordImpl.xml
                  containing the additional parameters and place it in your
merge dir.
              -->
            </generator>
        </id>

        <discriminator
            column="interfaceType"
        />

        <property
            name="status"
            type="int"
            update="true"
            insert="true"
            column="status"
        />

        <property
            name="siteRef"
            type="java.lang.String"
            update="true"
            insert="true"
            column="dlfSiteRef"
        />

        <property
            name="transmissionNumber"
            type="int"
            update="true"
            insert="true"
            column="transmissionNumber"
        />

        <property
            name="transmissionTimestamp"
            type="java.sql.Date"
            update="true"
            insert="true"
            column="transmissionTimestamp"
        />

        <property
            name="interfaceType"
            type="int"
            update="true"
            insert="true"
            column="interfaceType"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-TransferRecordImpl.xml
            containing the additional properties and place it in your merge
dir.
        -->

    </class>

</hibernate-mapping>


so there's no trace of the subclass....
i made TransferRecordImpl abstract cos i found on some messages sent to
hibernate forum that it could be better if
the parent class was abstract....

can anyone tell me how can i generate proper mappings?
here's my mvn  task

  <plugins>
      <plugin>
         <artifactId>xdoclet-maven-plugin</artifactId>
         <groupId>org.codehaus.mojo</groupId>
         <executions>
         <execution>
              <phase>generate-sources</phase>
             <goals>
                <goal>xdoclet</goal>
             </goals>
             <configuration>
                <tasks>
                <echo message="Generating HBM files from java source to
${basedir}/src/main/resources"/>
                <hibernatedoclet destdir="${basedir}/src/main/resources/"
excludedtags="@version,@author,@todo,@see,@desc" verbose="true">
                   <fileset dir="${basedir}/src/main/java"
includes="**/hibernate/*.java"/>
                   <hibernate version="3.0" />
                </hibernatedoclet>
                </tasks>
                    </configuration>
           </execution>
          </executions>
      </plugin>
....
 </plugins>


could anyone help me out?

thanks in advance and regards
 Marco

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
xdoclet-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user