Sounds almost like you have a wrong version of xjavadoc or xdoclet? That
one is newer than the other? I'm pretty much just guessing here..

A problem I've had with hibernatedoclet is that it would not work without
the <hibernate> subelement. Even though I didn't need the xml mapping
files generated (as they were already generated by Middlegen), I still
needed in there just to get the <jbossservice> element working. Ended up
with something like this:

<hibernatedoclet
        destdir="${build.sar-meta.dir}"
        excludedtags="@version,@author,@todo"
        force="${generated.forced}"
        mergedir="${src.dir}"
        verbose="false">

        <fileset dir="${build.gen-src.dir}">
                <include name="**/hibernate/*.java"/>
        </fileset>

        <jbossservice
                depends="jboss.jca:service=LocalTxCM,name=AirlineDS"
                serviceName="AirlineHibernate"
                jndiName="AirlineHibernateFactory"
                dataSource="${datasource.jndi.name}"
                dialect="net.sf.hibernate.dialect.MySQLDialect"
                useOuterJoin="true"
                showSql="true"

transactionManagerStrategy="net.sf.hibernate.transaction.JBossTransactionManagerLookup"

transactionStrategy="net.sf.hibernate.transaction.JTATransactionFactory"
                userTransactionName="UserTransaction"
        />

        <hibernate version="2.0"/>

</hibernatedoclet>

Not sure if any of these things really relate to your problem..

Cheers
.eivind

On Fri, 8 Oct 2004, Joel Hillacre wrote:

> 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 do not even know where to look with this. Google does
> not seem to turn up anything. I also searched of the hibernate forums, and
> posted on the xdoclet-user list. Any help would be greatly appreciated.
>   Joel Hillacre
>
> [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:
>    <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
>
> 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
>
> <?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>
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
> Use IT products in your business? Tell us what you think of them. Give us
> Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
> http://productguide.itmanagersjournal.com/guidepromo.tmpl
> _______________________________________________
> middlegen-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/middlegen-user
>
>


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
middlegen-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/middlegen-user

Reply via email to