Fellow xdoclet users, have been using XDoclet 1.2.3, and have the following 2 questions:

 

1)  how do you control the order of the columns output to the mapping file. It appears that the

    identifier field is always first and that columns are ordered first from the child-most class up through

    the columns of the parent classes, seeming to always follow a java destructor call pattern.

    I would like the order to be more like a constructor call where a child class' columns are

    appended in the generated mapping file after its parent's columns.

   

2)  how do you completely override a component property's column name. It appears that the @hibernat.component tag

    does not have a column= option and that one must use the @hibernat.component's prefix attribute to prepend to the component's @hibernate.property's column= name.

    Don't want to prepend a prefix, want the method using the component to override the component's column name.

 

In other words, given these three classes:

 

public class Entity{

    private String id;

    private String name;

    private TimeStamp timeCreated;

           

   /**  @hibernate.id  generator-class="native" column="EntityID" */

    public long getIdAsLong() {

        long i = Long.parseLong(id);

        return i;

    }

 

    /**  @hibernate.property  */

    public String getName(){

        return name;

    }

 

    /**  @hibernate.component class="com.inforise.time.TimeStamp" prefix="TimeCreated__"  */

    public TimeStamp getTimeCreated() {

        return timeCreated;

    }   

}

           

public class TimeStamp{

    private Date date;

           

    /**  @hibernate.property type="timestamp"  */

    public Date getDate(){

        return date;

    }

}

 

 /*  @hibernate.class table="users" */

public class User extends Entity{

    private String email = null;

 

     /*  @hibernate.property column="Email" */

    public String getEmail(){

        return email;

    }

}

 

 

Am getting the following mapping file generated by xdoclet:

 

<hibernate-mapping>

    <class name="com.inforise.use.User" table="users" >

 

        <id name="idAsLong" column="EntityID" type="long" >

            <generator class="native"> </generator>

        </id>

 

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

 

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

 

        <component name="timeCreated" class="com.inforise.time.TimeStamp" >

            <property name="date" type="timestamp" update="true" insert="true" column="TimeCreated__date" />

        </component>

     </class>

</hibernate-mapping>

 

 

Would like to have this instead :

 

<hibernate-mapping>

    <class name="com.inforise.use.User" table="users" >

        <id name="idAsLong" column="EntityID" type="long" >

            <generator class="native"> </generator>

        </id>

 

<!-- answer for question 1 should provide the following order of fields: -->

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

 

        <component name="timeCreated" class="com.inforise.time.TimeStamp" >

 

   <!-- answer for question 2 should provide this line instead (note column="TimeCreated" instead of "TimeCreated__date"): -->

            <property name="date" type="timestamp" update="true" insert="true" column="TimeCreated" />

        </component>

 

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

 

     </class>

</hibernate-mapping>

 

Currently, am working around question 2 using xtask to modify the column attribute, but it ain't pretty:~;

it would be nice if all method related @hibernate tags would have a column attribute that completely overrides

any derived column names, ie.: @hibernate.component column="TimeCreated"... and <component column="TimeCreated"...

 

On the other hand, have not as of yet come up with a work-around for question 1, but am thinking there should be

a way to set the order pattern since there is a pattern now. Perhaps there could be a orderPattern="constructor|destructor"

attribute for the hibernatedoclet tag.

 

Sincerely,

Mark Rines                           

-------------------------------------------------------------------------
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
xdoclet-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to