-->
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.  [ 1 post ] 
Author Message
 Post subject: hibernatedoclet exception
PostPosted: Wed Oct 06, 2004 5:03 pm 
Newbie

Joined: Wed Oct 06, 2004 4:39 pm
Posts: 2
Location: Canada
I am having trouble generating hibernate.cfg.xml using xdoclet hibernatedoclet. The following exception is thrown during the running of my build. To be honest, I dont even know where to look with this. Any help would be greatly appreciated.

Code:
[hibernatedoclet] - Running <hibernatecfg/>
[hibernatedoclet] java.lang.NoSuchMethodError: xjavadoc.XJavaDoc.setDocEncoding(Ljava/lang/String;)V
[hibernatedoclet]       at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:181)
[hibernatedoclet]       at xdoclet.TemplateSubTask.execute(TemplateSubTask.java:486)
[hibernatedoclet]       at xdoclet.XDocletMain.start(XDocletMain.java:48)
[hibernatedoclet]       at xdoclet.DocletTask.start(DocletTask.java:462)
[hibernatedoclet]       at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:96)
[hibernatedoclet]       at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:193)
[hibernatedoclet]       at org.apache.tools.ant.Task.perform(Task.java:341)
[hibernatedoclet]       at org.apache.tools.ant.Target.execute(Target.java:309)
[hibernatedoclet]       at org.apache.tools.ant.Target.performTasks(Target.java:336)
[hibernatedoclet]       at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[hibernatedoclet]       at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
[hibernatedoclet]       at org.apache.tools.ant.Main.runBuild(Main.java:609)
[hibernatedoclet]       at org.apache.tools.ant.Main.start(Main.java:196)
[hibernatedoclet]       at org.apache.tools.ant.Main.main(Main.java:235)


Part of my build.xml:
Code:
   <target name="runMiddlegen" description="Run our Middlegen code generator" depends="ckDriver, mkBuildDir">
      <taskdef
         name="middlegen"
         classname="middlegen.MiddlegenTask"
         classpathref="lib.class.path"
      />
      <middlegen
         appname="TSIBUILD"
         gui="false"
         databaseurl="${database.url}"
         driver="${database.driver}"
         username="${database.userid}"
         password="${database.password}"
         includeViews="false"
      >
         <struts
            destination="${struts.temp.dir}"
            package="${package}"
         ><!--
            <jsp
               name="myjsp"
               destination="${jsp.temp.dir}"
            />
         -->
         </struts>
         <hibernate
            destination="${hibernate.temp.dir}"
            package="${package}.beans"
            genXDocletTags="true"
            javaTypeMapper="middlegen.plugins.hibernate.HibernateJavaTypeMapper"
         />
         <spring
            destination="${spring.temp.dir}"
            package="${package}"
            service="service"
            bean="beans"
            dao="dao"
         >
         </spring>
      </middlegen>
      <taskdef
         name="folderCapitalizer"
         classname="com.tsiware.myAntTasks.folderCapitalizerTask"
         classpathref="lib.class.path"
      />
      <folderCapitalizer basedir="${gensrc.dir}/${package.dir}/actions"/>
   </target>
   <target name="runhbm2java" description="Turn our hibernate .hbm.xml files into .java files" depends="runMiddlegen">
      <mkdir dir="${gensrc.dir}/${package.dir}/beans"/>
      <taskdef
         name="hbm2java"
         classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
         classpathref="lib.class.path"
      />
      <hbm2java output="${gensrc.dir}">
         <fileset dir="${gensrc.dir}">
            <include name="**/*.hbm.xml"/>
         </fileset>
      </hbm2java>
      <mkdir dir="${build.sar.dir}"/>
      <jar jarfile="${sar.file}" >
         <fileset dir="${gensrc.dir}">
            <include name="**/beans/*.xml"/>
         </fileset>
         <fileset dir="${classes.dir}">
            <include name="**/beans/*.class"/>
         </fileset>
         <zipfileset dir="${build.sar-meta.dir}" prefix="META-INF">
            <include name="*.xml"/>
         </zipfileset>
      </jar>
   </target>
   <target name="hibernatedoclet" description="generate hibernate.cfg.xml" depends="runhbm2java">
      <taskdef name="hibernatedoclet" classname="xdoclet.modules.hibernate.HibernateDocletTask">
         <classpath refid="lib.class.path"/>
      </taskdef>
      <hibernatedoclet
         destdir="${build.sar-meta.dir}"
         excludedtags="@version,@author,@todo"
         force="${generated.forced}"
         mergedir="${src.dir}"
         verbose="false">
         <fileset dir="${gensrc.dir}">
            <include name="**/bean/*.java"/>
         </fileset>
         <hibernatecfg
            jdbcUrl="${database.url}"
            dialect="net.sf.hibernate.dialect.MySQLDialect"
            driver="${database.driver}"
            userName="${database.userid}"
            password="${database.password}"
          >
          </hibernatecfg>
      </hibernatedoclet>
   </target>


Group.java, a POJO in **/beans/*.java
Code:
package com.tsiware.beans;

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

/**
*        @hibernate.class
*         table="groups"
*     
*/
public class Group implements Serializable {

    /** identifier field */
    private Integer groupId;

    /** persistent field */
    private String name;

    /** persistent field */
    private Date registrationDate;

    /** persistent field */
    private BigDecimal annualBudget;

    /** persistent field */
    private Set users;

    /** full constructor */
    public Group(Integer groupId, String name, Date registrationDate, BigDecimal annualBudget, Set users) {
        this.groupId = groupId;
        this.name = name;
        this.registrationDate = registrationDate;
        this.annualBudget = annualBudget;
        this.users = users;
    }

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

    /**
     *            @hibernate.id
     *             generator-class="assigned"
     *             type="java.lang.Integer"
     *             column="groupId"
     *         
     */
    public Integer getGroupId() {
        return this.groupId;
    }

    public void setGroupId(Integer groupId) {
        this.groupId = groupId;
    }

    /**
     *            @hibernate.property
     *             column="name"
     *             length="255"
     *             not-null="true"
     *         
     */
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     *            @hibernate.property
     *             column="registrationDate"
     *             length="10"
     *             not-null="true"
     *         
     */
    public Date getRegistrationDate() {
        return this.registrationDate;
    }

    public void setRegistrationDate(Date registrationDate) {
        this.registrationDate = registrationDate;
    }

    /**
     *            @hibernate.property
     *             column="annualBudget"
     *             length="20"
     *             not-null="true"
     *         
     */
    public BigDecimal getAnnualBudget() {
        return this.annualBudget;
    }

    public void setAnnualBudget(BigDecimal annualBudget) {
        this.annualBudget = annualBudget;
    }

    /**
     *            @hibernate.set
     *             lazy="true"
     *             inverse="true"
     *             cascade="none"
     *            @hibernate.collection-key
     *             column="groupId"
     *            @hibernate.collection-one-to-many
     *             class="com.tsiware.beans.User"
     *         
     */
    public Set getUsers() {
        return this.users;
    }

    public void setUsers(Set users) {
        this.users = users;
    }

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

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

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

}


Group.hbm.xml, middlegen generated in **/beans/*.hbm.xml
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 2.1

    http://boss.bekk.no/boss/middlegen/
    http://www.hibernate.org/
-->

<class
    name="com.tsiware.beans.Group"
    table="groups"
>
    <meta attribute="class-description" inherit="false">
       @hibernate.class
        table="groups"
    </meta>

    <id
        name="groupId"
        type="java.lang.Integer"
        column="groupId"
    >
        <meta attribute="field-description">
           @hibernate.id
            generator-class="assigned"
            type="java.lang.Integer"
            column="groupId"

        </meta>
        <generator class="assigned" />
    </id>

    <property
        name="name"
        type="java.lang.String"
        column="name"
        not-null="true"
        length="255"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="name"
            length="255"
            not-null="true"
        </meta>   
    </property>
    <property
        name="registrationDate"
        type="java.sql.Date"
        column="registrationDate"
        not-null="true"
        length="10"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="registrationDate"
            length="10"
            not-null="true"
        </meta>   
    </property>
    <property
        name="annualBudget"
        type="java.math.BigDecimal"
        column="annualBudget"
        not-null="true"
        length="20"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="annualBudget"
            length="20"
            not-null="true"
        </meta>   
    </property>

    <!-- Associations -->
 
    <!-- bi-directional one-to-many association to User -->
    <set
        name="users"
        lazy="true"
        inverse="true"
      cascade="none"
    >
        <meta attribute="field-description">
           @hibernate.set
            lazy="true"
            inverse="true"
            cascade="none"

           @hibernate.collection-key
            column="groupId"

           @hibernate.collection-one-to-many
            class="com.tsiware.beans.User"
        </meta>
        <key>
            <column name="groupId" />
        </key>
        <one-to-many
            class="com.tsiware.beans.User"
        />
    </set>

</class>
</hibernate-mapping>


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

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.