-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: New release of Middlegen strangeness
PostPosted: Mon Jan 12, 2004 5:07 pm 
Newbie

Joined: Tue Dec 09, 2003 8:31 am
Posts: 17
I have been using middlegen and hibernate to create a bottum-up persistence. I noticed a new release of Middlegen was out as well as a new middlegen hibernate plugin, so I downloaded new copies. I replaced the following jar files:
middlegen-2.0-b2-dev.jar
middlegen-entitybean-plugin-2.0-b2-dev.jar
middlegen-hibernate-plugin-2.0-b2-dev.jar

with:

middlegen-2.0-vo.jar
middlegen-entitybean-plugin-2.0-vo.jar
middlegen-hibernate-plugin-2.0-vo.jar

and reran my build. But I get errors in the hibernatedoclet step. It looks like the hbm2java step in my build is behaving differently due to the recent changes in the hbm.xml files.

This is what the hbm.xml file looked like with the old jars:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
   
<hibernate-mapping>
<!--
    Created by Middlegen Hibernate plugin

    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->

<class
    name="com.invisioninc.hibernate.data.DtOutletDaypart"
    table="DT_OUTLET_DAYPART"
>
    <meta attribute="class-description">
       @hibernate.class
        table="DT_OUTLET_DAYPART"
    </meta>

    <composite-id name="comp_id" class="com.invisioninc.hibernate.data.DtOutletDaypartPK">
        <meta attribute="field-description">
           @hibernate.id
            generator-class="assigned"
        </meta>
        <!-- bi-directional many-to-one association to DtOutlet -->
        <key-many-to-one
           name="dtOutlet"
           class="com.invisioninc.hibernate.data.DtOutlet"
       >
           <column name="OUTLET_CD" />
       </key-many-to-one>
        <!-- bi-directional many-to-one association to DtDaypart -->
        <key-many-to-one
           name="dtDaypart"
           class="com.invisioninc.hibernate.data.DtDaypart"
       >
           <column name="DAYPART_ID" />
       </key-many-to-one>
    </composite-id>   

    <property
        name="defaultInd"
        type="java.lang.String"
        column="DEFAULT_IND"
        not-null="true"
        length="1"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="DEFAULT_IND"
            length="1"
            not-null="true"
        </meta>   
    </property>
    <property
        name="auditDate"
        type="java.sql.Timestamp"
        column="AUDIT_DATE"
        not-null="true"
        length="7"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="AUDIT_DATE"
            length="7"
            not-null="true"
        </meta>   
    </property>
    <property
        name="auditUser"
        type="int"
        column="AUDIT_USER"
        not-null="true"
        length="6"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="AUDIT_USER"
            length="6"
            not-null="true"
        </meta>   
    </property>
    <property
        name="daysAndTimes"
        type="java.lang.String"
        column="DAYS_AND_TIMES"
        length="100"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="DAYS_AND_TIMES"
            length="100"
        </meta>   
    </property>
    <property
        name="listOrder"
        type="java.math.BigDecimal"
        column="LIST_ORDER"
        not-null="true"
        length="4"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="LIST_ORDER"
            length="4"
            not-null="true"
        </meta>   
    </property>
    <property
        name="activeInd"
        type="java.lang.String"
        column="ACTIVE_IND"
        not-null="true"
        length="1"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="ACTIVE_IND"
            length="1"
            not-null="true"
        </meta>   
    </property>
    <property
        name="stewActiveInd"
        type="java.lang.String"
        column="STEW_ACTIVE_IND"
        not-null="true"
        length="1"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="STEW_ACTIVE_IND"
            length="1"
            not-null="true"
        </meta>   
    </property>

    <!-- associations -->

</class>
</hibernate-mapping>


and here is the java code that is generated from that using the old jars.

Code:
package com.invisioninc.hibernate.data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
*        @hibernate.class
*         table="DT_OUTLET_DAYPART"
*     
*/
public class DtOutletDaypart implements Serializable {

    /** identifier field */
    private com.invisioninc.hibernate.data.DtOutletDaypartPK comp_id;

    /** persistent field */
    private String defaultInd;

    /** persistent field */
    private Date auditDate;

    /** persistent field */
    private int auditUser;

    /** nullable persistent field */
    private String daysAndTimes;

    /** persistent field */
    private BigDecimal listOrder;

    /** persistent field */
    private String activeInd;

    /** persistent field */
    private String stewActiveInd;

    /** full constructor */
    public DtOutletDaypart(com.invisioninc.hibernate.data.DtOutletDaypartPK comp_id, String defaultInd, Date auditDate, int auditUser, String daysAndTimes, BigDecimal listOrder, String activeInd, String stewActiveInd) {
        this.comp_id = comp_id;
        this.defaultInd = defaultInd;
        this.auditDate = auditDate;
        this.auditUser = auditUser;
        this.daysAndTimes = daysAndTimes;
        this.listOrder = listOrder;
        this.activeInd = activeInd;
        this.stewActiveInd = stewActiveInd;
    }

    /** default constructor */
    public DtOutletDaypart() {
    }

    /** minimal constructor */
    public DtOutletDaypart(com.invisioninc.hibernate.data.DtOutletDaypartPK comp_id, String defaultInd, Date auditDate, int auditUser, BigDecimal listOrder, String activeInd, String stewActiveInd) {
        this.comp_id = comp_id;
        this.defaultInd = defaultInd;
        this.auditDate = auditDate;
        this.auditUser = auditUser;
        this.listOrder = listOrder;
        this.activeInd = activeInd;
        this.stewActiveInd = stewActiveInd;
    }

    /**
     *            @hibernate.id
     *             generator-class="assigned"
     *         
     */
    public com.invisioninc.hibernate.data.DtOutletDaypartPK getComp_id() {
        return this.comp_id;
    }

    public void setComp_id(com.invisioninc.hibernate.data.DtOutletDaypartPK comp_id) {
        this.comp_id = comp_id;
    }

    /**
     *            @hibernate.property
     *             column="DEFAULT_IND"
     *             length="1"
     *             not-null="true"
     *         
     */
    public String getDefaultInd() {
        return this.defaultInd;
    }

    public void setDefaultInd(String defaultInd) {
        this.defaultInd = defaultInd;
    }

    /**
     *            @hibernate.property
     *             column="AUDIT_DATE"
     *             length="7"
     *             not-null="true"
     *         
     */
    public Date getAuditDate() {
        return this.auditDate;
    }

    public void setAuditDate(Date auditDate) {
        this.auditDate = auditDate;
    }

    /**
     *            @hibernate.property
     *             column="AUDIT_USER"
     *             length="6"
     *             not-null="true"
     *         
     */
    public int getAuditUser() {
        return this.auditUser;
    }

    public void setAuditUser(int auditUser) {
        this.auditUser = auditUser;
    }

    /**
     *            @hibernate.property
     *             column="DAYS_AND_TIMES"
     *             length="100"
     *         
     */
    public String getDaysAndTimes() {
        return this.daysAndTimes;
    }

    public void setDaysAndTimes(String daysAndTimes) {
        this.daysAndTimes = daysAndTimes;
    }

    /**
     *            @hibernate.property
     *             column="LIST_ORDER"
     *             length="4"
     *             not-null="true"
     *         
     */
    public BigDecimal getListOrder() {
        return this.listOrder;
    }

    public void setListOrder(BigDecimal listOrder) {
        this.listOrder = listOrder;
    }

    /**
     *            @hibernate.property
     *             column="ACTIVE_IND"
     *             length="1"
     *             not-null="true"
     *         
     */
    public String getActiveInd() {
        return this.activeInd;
    }

    public void setActiveInd(String activeInd) {
        this.activeInd = activeInd;
    }

    /**
     *            @hibernate.property
     *             column="STEW_ACTIVE_IND"
     *             length="1"
     *             not-null="true"
     *         
     */
    public String getStewActiveInd() {
        return this.stewActiveInd;
    }

    public void setStewActiveInd(String stewActiveInd) {
        this.stewActiveInd = stewActiveInd;
    }

    public String toString() {
        return new ToStringBuilder(this)
            .append("comp_id", getComp_id())
            .toString();
    }

    public boolean equals(Object other) {
        if ( !(other instanceof DtOutletDaypart) ) return false;
        DtOutletDaypart castOther = (DtOutletDaypart) other;
        return new EqualsBuilder()
            .append(this.getComp_id(), castOther.getComp_id())
            .isEquals();
    }

    public int hashCode() {
        return new HashCodeBuilder()
            .append(getComp_id())
            .toHashCode();
    }

}


Here is the hbm.xml file with the new jars:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
   
<hibernate-mapping>
<!--
    Created by the Middlegen Hibernate plugin

    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->

<class
    name="com.invisioninc.hibernate.data.DtOutletDaypart"
    table="DT_OUTLET_DAYPART"
>
    <meta attribute="class-description" inherit="false">
       @hibernate.class
        table="DT_OUTLET_DAYPART"
    </meta>

    <composite-id name="comp_id" class="com.invisioninc.hibernate.data.DtOutletDaypartPK">
        <meta attribute="class-description" inherit="false">
           @hibernate.id
            generator-class="assigned"
        </meta>
        <!-- bi-directional many-to-one association to DtOutlet -->
        <key-many-to-one
           name="dtOutlet"
           class="com.invisioninc.hibernate.data.DtOutlet"
       >
            <meta attribute="field-description">
               @hibernate.many-to-one
                column="OUTLET_CD""
            </meta>
           <column name="OUTLET_CD" />
       </key-many-to-one>
        <!-- bi-directional many-to-one association to DtDaypart -->
        <key-many-to-one
           name="dtDaypart"
           class="com.invisioninc.hibernate.data.DtDaypart"
       >
            <meta attribute="field-description">
               @hibernate.many-to-one
                column="DAYPART_ID""
            </meta>
           <column name="DAYPART_ID" />
       </key-many-to-one>
    </composite-id>   

    <property
        name="defaultInd"
        type="java.lang.String"
        column="DEFAULT_IND"
        not-null="true"
        length="1"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="DEFAULT_IND"
            length="1"
            not-null="true"
        </meta>   
    </property>
    <property
        name="auditDate"
        type="java.sql.Timestamp"
        column="AUDIT_DATE"
        not-null="true"
        length="7"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="AUDIT_DATE"
            length="7"
            not-null="true"
        </meta>   
    </property>
    <property
        name="auditUser"
        type="int"
        column="AUDIT_USER"
        not-null="true"
        length="6"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="AUDIT_USER"
            length="6"
            not-null="true"
        </meta>   
    </property>
    <property
        name="daysAndTimes"
        type="java.lang.String"
        column="DAYS_AND_TIMES"
        length="100"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="DAYS_AND_TIMES"
            length="100"
        </meta>   
    </property>
    <property
        name="listOrder"
        type="java.math.BigDecimal"
        column="LIST_ORDER"
        not-null="true"
        length="4"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="LIST_ORDER"
            length="4"
            not-null="true"
        </meta>   
    </property>
    <property
        name="activeInd"
        type="java.lang.String"
        column="ACTIVE_IND"
        not-null="true"
        length="1"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="ACTIVE_IND"
            length="1"
            not-null="true"
        </meta>   
    </property>
    <property
        name="stewActiveInd"
        type="java.lang.String"
        column="STEW_ACTIVE_IND"
        not-null="true"
        length="1"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="STEW_ACTIVE_IND"
            length="1"
            not-null="true"
        </meta>   
    </property>

    <!-- associations -->

</class>
</hibernate-mapping>


and the code generated from that using the new jars:
Code:
package com.invisioninc.hibernate.data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
*        @hibernate.class
*         table="DT_OUTLET_DAYPART"
*     
*/
public class DtOutletDaypart implements Serializable {

    /** identifier field */
    private com.invisioninc.hibernate.data.DtOutletDaypartPK comp_id;

    /** persistent field */
    private String defaultInd;

    /** persistent field */
    private Date auditDate;

    /** persistent field */
    private int auditUser;

    /** nullable persistent field */
    private String daysAndTimes;

    /** persistent field */
    private BigDecimal listOrder;

    /** persistent field */
    private String activeInd;

    /** persistent field */
    private String stewActiveInd;

    /** full constructor */
    public DtOutletDaypart(com.invisioninc.hibernate.data.DtOutletDaypartPK comp_id, String defaultInd, Date auditDate, int auditUser, String daysAndTimes, BigDecimal listOrder, String activeInd, String stewActiveInd) {
        this.comp_id = comp_id;
        this.defaultInd = defaultInd;
        this.auditDate = auditDate;
        this.auditUser = auditUser;
        this.daysAndTimes = daysAndTimes;
        this.listOrder = listOrder;
        this.activeInd = activeInd;
        this.stewActiveInd = stewActiveInd;
    }

    /** default constructor */
    public DtOutletDaypart() {
    }

    /** minimal constructor */
    public DtOutletDaypart(com.invisioninc.hibernate.data.DtOutletDaypartPK comp_id, String defaultInd, Date auditDate, int auditUser, BigDecimal listOrder, String activeInd, String stewActiveInd) {
        this.comp_id = comp_id;
        this.defaultInd = defaultInd;
        this.auditDate = auditDate;
        this.auditUser = auditUser;
        this.listOrder = listOrder;
        this.activeInd = activeInd;
        this.stewActiveInd = stewActiveInd;
    }

    public com.invisioninc.hibernate.data.DtOutletDaypartPK getComp_id() {
        return this.comp_id;
    }

    public void setComp_id(com.invisioninc.hibernate.data.DtOutletDaypartPK comp_id) {
        this.comp_id = comp_id;
    }

    /**
     *            @hibernate.property
     *             column="DEFAULT_IND"
     *             length="1"
     *             not-null="true"
     *         
     */
    public String getDefaultInd() {
        return this.defaultInd;
    }

    public void setDefaultInd(String defaultInd) {
        this.defaultInd = defaultInd;
    }

    /**
     *            @hibernate.property
     *             column="AUDIT_DATE"
     *             length="7"
     *             not-null="true"
     *         
     */
    public Date getAuditDate() {
        return this.auditDate;
    }

    public void setAuditDate(Date auditDate) {
        this.auditDate = auditDate;
    }

    /**
     *            @hibernate.property
     *             column="AUDIT_USER"
     *             length="6"
     *             not-null="true"
     *         
     */
    public int getAuditUser() {
        return this.auditUser;
    }

    public void setAuditUser(int auditUser) {
        this.auditUser = auditUser;
    }

    /**
     *            @hibernate.property
     *             column="DAYS_AND_TIMES"
     *             length="100"
     *         
     */
    public String getDaysAndTimes() {
        return this.daysAndTimes;
    }

    public void setDaysAndTimes(String daysAndTimes) {
        this.daysAndTimes = daysAndTimes;
    }

    /**
     *            @hibernate.property
     *             column="LIST_ORDER"
     *             length="4"
     *             not-null="true"
     *         
     */
    public BigDecimal getListOrder() {
        return this.listOrder;
    }

    public void setListOrder(BigDecimal listOrder) {
        this.listOrder = listOrder;
    }

    /**
     *            @hibernate.property
     *             column="ACTIVE_IND"
     *             length="1"
     *             not-null="true"
     *         
     */
    public String getActiveInd() {
        return this.activeInd;
    }

    public void setActiveInd(String activeInd) {
        this.activeInd = activeInd;
    }

    /**
     *            @hibernate.property
     *             column="STEW_ACTIVE_IND"
     *             length="1"
     *             not-null="true"
     *         
     */
    public String getStewActiveInd() {
        return this.stewActiveInd;
    }

    public void setStewActiveInd(String stewActiveInd) {
        this.stewActiveInd = stewActiveInd;
    }

    public String toString() {
        return new ToStringBuilder(this)
            .append("comp_id", getComp_id())
            .toString();
    }

    public boolean equals(Object other) {
        if ( !(other instanceof DtOutletDaypart) ) return false;
        DtOutletDaypart castOther = (DtOutletDaypart) other;
        return new EqualsBuilder()
            .append(this.getComp_id(), castOther.getComp_id())
            .isEquals();
    }

    public int hashCode() {
        return new HashCodeBuilder()
            .append(getComp_id())
            .toHashCode();
    }

}


The difference is in the getter for the composite id does not have the metadata for the hibernate.id in the java class. With the old jars the meta data in the hbm xml file was copied into the java class. So it looks like the hbm.xml file is correct with both the new and old jars but hbm2java is behaving differently. I am still using the the same hibernate-tools.jar for both instances since I did not see a new copy of that jar.

Here is the error I get during the ant build:
Code:

BUILD FAILED
file:c:/cvsrepos/datatest/build.xml:377: Unexpected error
   at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:123)
   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:193)
   at org.apache.tools.ant.Task.perform(Task.java:341)
   at org.apache.tools.ant.Target.execute(Target.java:309)
   at org.apache.tools.ant.Target.performTasks(Target.java:336)
   at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
   at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
   at org.apache.tools.ant.Main.runBuild(Main.java:609)
   at org.apache.tools.ant.Main.start(Main.java:196)
   at org.apache.tools.ant.Main.main(Main.java:235)
Caused by: file:c:/cvsrepos/datatest/build.xml:377: XDoclet failed.
   at xdoclet.DocletTask.start(DocletTask.java:467)
   at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:110)
   ... 9 more
Caused by: xdoclet.XDocletException: Class com.invisioninc.hibernate.data.DtOutletDaypart misses ID property
   at xdoclet.modules.hibernate.HibernateTagsHandler.hasCompositeId_Impl(HibernateTagsHandler.java:482)
   at xdoclet.modules.hibernate.HibernateTagsHandler.ifHasPrimitiveId(HibernateTagsHandler.java:153)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at xdoclet.template.TemplateEngine.invoke(TemplateEngine.java:635)
   at xdoclet.template.TemplateEngine.invokeMethod(TemplateEngine.java:561)
   at xdoclet.template.TemplateEngine.invokeBlockMethod(TemplateEngine.java:959)
   at xdoclet.template.TemplateEngine.handleBlockTag(TemplateEngine.java:926)
   at xdoclet.template.TemplateEngine.handleTag(TemplateEngine.java:466)
   at xdoclet.template.TemplateEngine.generate(TemplateEngine.java:347)
   at xdoclet.template.TemplateEngine.start(TemplateEngine.java:414)
   at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:560)
   at xdoclet.TemplateSubTask.generateForClass(TemplateSubTask.java:767)
   at xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:667)
   at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:594)
   at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:198)
   at xdoclet.modules.hibernate.HibernateSubTask.execute(HibernateSubTask.java:123)
   at xdoclet.XDocletMain.start(XDocletMain.java:48)
   at xdoclet.DocletTask.start(DocletTask.java:464)
   ... 10 more


Thanks for any help.

Craig


Top
 Profile  
 
 Post subject: I think I found the problem
PostPosted: Mon Jan 12, 2004 5:39 pm 
Newbie

Joined: Tue Dec 09, 2003 8:31 am
Posts: 17
I did some more poking around and noticed that in the old hbm.xml files the meta tags for the generator has field-description but in the new hbm.xml files it says class-description.

I traced this to the hibernate.vm file in the middlegen-hibernate jar. I changed line 81, and 115 to field-description and reran my build with no issues.

Here is the first 130 lines of the vm file with my changes:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
   
<hibernate-mapping>
<!--
    Created by the Middlegen Hibernate plugin

    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->

<class
    name="${table.package}.${table.destinationClassName}"
    table="$table.sqlName"
#if($table.schemaName)
    schema="${table.databaseSchema}"
#end
#if(!$table.mutable)
    mutable="false"
#end
#if($table.proxy)
    proxy="${table.package}.${table.destinationClassName}"
#end
#if($table.dynamicUpdate)
    dynamic-update="true"
#end
#if($table.persisterName)
    persister="${table.persister}"
#end
>
#if($table.classDescriptionName)
    <meta attribute="class-description" inherit="false">
       ${table.classDescription}
    </meta>
#end
#if ($plugin.genXDocletTags)
    <meta attribute="class-description" inherit="false">
       @hibernate.class
        table="$table.sqlName"
#if($table.schemaName)
        schema="${table.databaseSchema}"
#end
#if(!$table.mutable)
        mutable="false"
#end
#if($table.dynamicUpdate)
        dynamic-update="true"
#end         
#if($table.proxy)
        proxy="${table.package}.${table.destinationClassName}"
#end
    </meta>
#end
#if($table.extendsName)
    <meta attribute="extends" inherit="false">${table.extends}</meta>
#end
#if($table.implementLifecycle)
    <meta attribute="implements" inherit="false">net.sf.hibernate.Lifecycle</meta>
#end
#if($table.implementValidatable)
    <meta attribute="implements" inherit="false">net.sf.hibernate.Validatable</meta>
#end
####### Generate all the extra (non hibernate) implements meta data
#foreach ( $implClass in $table.implements )
    <meta attribute="implements" inherit="false">${implClass}</meta>
#end
#if($table.classScopeName)
    <meta attribute="scope-class" inherit="false">${table.classScope}</meta>
#end
#set ($VersionId = true)

## Case where we have a composite key
#if ($table.compositeKey)
## Special case where there is no primary key (bad database design).
## In this case we put all the properties in a composite id.
#if ($table.primaryKeyColumns.size() == 0 )
    <composite-id>
#if ($plugin.genXDocletTags)
        <meta attribute="field-description" inherit="false">
           @hibernate.id
            generator-class="assigned"
        </meta>
#end
#foreach ( $compKeyColumn in $table.basicColumns )
        <key-property
            name="${compKeyColumn.variableName}"
            column="${compKeyColumn.sqlName}"
            type="${compKeyColumn.javaType}"
#if ($compKeyColumn.sized)
            length="$compKeyColumn.size"
#end
#if ($plugin.genXDocletTags)
        >
            <meta attribute="field-description">
               @hibernate.property
                column="${compKeyColumn.sqlName}"
#if ($column.sized)           
                length="$compKeyColumn.size"
#end
            </meta>
        </key-property>
#else
        />
#end
#end
#else
#if ($plugin.genIntergratedCompositeKeys)
    <composite-id>
#else
    <composite-id name="comp_id" class="${table.package}.${table.compoundKeyDestinationClassName}">
#end
#if ($plugin.genXDocletTags)
        <meta attribute="field-description" inherit="false">
           @hibernate.id
            generator-class="assigned"
        </meta>
#end
#foreach ( $compKeyColumn in $table.primaryNotForeignKeyColumns )
        <key-property
            name="${compKeyColumn.variableName}"
            column="${compKeyColumn.sqlName}"
            type="${compKeyColumn.javaType}"
#if ($compKeyColumn.sized)
            length="$compKeyColumn.size"
#end
#if ($plugin.genXDocletTags)
        >
            <meta attribute="field-description">
.
.
.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 12, 2004 6:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
please submit a patch to the JIRA.

And if you are using the velocity version of hbm2java you are using a TOTALLY different generator than the version provided in the previous versions.

(and i still encourage you to use the non-velocity based hbm2java, as it is much more complete and extensible)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2004 12:53 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I have taken note of it (but it shold be recorded anyway) and I will check it out.


Top
 Profile  
 
 Post subject: hbm2java version
PostPosted: Tue Jan 13, 2004 11:03 am 
Newbie

Joined: Tue Dec 09, 2003 8:31 am
Posts: 17
Max,

I am using the ant task for hbm2java

Code:
   <target name="hbm2java"
      description="Generate .java from .hbm files." depends="init">
      <property name="hbm.dir" location="${build.generate.dir}/com/invisioninc/optimizer/services/"/>
           
        <replaceregexp
         match='cascade="none"'
         replace='cascade="all"'
         byline="true">
         <fileset dir="${hbm.dir}" includes="PoRequest.hbm.xml,PoRun.hbm.xml" />
        </replaceregexp>
      
      <mkdir dir="${build.generate.dir}"/>
      <taskdef
         name="hbm2java"
         classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
         classpathref="hibernate.classpath"
      />
      
      <hbm2java output="${build.generate.dir}" classpathref="hibernate.classpath">
         <fileset dir="${build.generate.dir}">
            <include name="**/*.hbm.xml"/>
         </fileset>
      </hbm2java>
   </target>
   


Above is my ant target for converting the hbm.xml files to java. Is this using velocity?

BTW, I submitted the patch HB-620. I attached the copy of the hibernate.vm file. If there is anything else you need for the patch please let me know.

Thanks,

Craig


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2004 11:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Thanks for the JIRA issue. Its a Middlegen issue. You are not using velocity as the generator in hbm2java (which is best [at least for the moment]).


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.