-->
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: [XDoclet] No hbm-files generated
PostPosted: Sun Dec 05, 2004 10:37 am 
Newbie

Joined: Tue Nov 30, 2004 5:07 am
Posts: 14
Hallo everybody,

I've a problem when trying to create *.hbm.xml-files from my XDoclet-java-files.
Ant tells me:

[...]
Code:
compileXDoclet:
    [javac] Compiling 1 source file to D:\DA\workspace\OOD\dist
hibernate:
[hibernatedoclet] (XDocletMain.start                   47  ) Running <hibernate/>
BUILD SUCCESSFUL
Total time: 2 seconds


But no hbm-files have been created. :( From http://www.myeclipseide.com/index.php?name=PNphpBB2&file=viewtopic&p=24663 I know that it might be something about my java-files not found?

If I intentionally set {pojoFiles.dir} to a wrong directory, ant tells me that it couldn't find that dir. So I think I'm in the correct directory.
Any ideas what I've done wrong?

Thanks
smo



----
build.xml
----
Code:
[...]
<property name="properties.dir" value="WEB-INF/src"/>
<property name="libs" value="WEB-INF/lib"/>
<property name="pojoFiles.dir" value="WEB-INF/src/com/mine/pojo"/>
<property name="dist" value="dist"/>
[...]
<target name="hibernate" depends="compileXDoclet" description="Generates Hibernate class descriptor files.">               
  <taskdef name="hibernatedoclet" classname="xdoclet.modules.hibernate.HibernateDocletTask">         
<classpath>
<fileset dir="${libs}">
                  <include name="xdoclet-1.2.2.jar"/>
                  <include name="xdoclet-hibernate-module-1.2.2.jar"/>
                  <include name="xjavadoc-1.1.jar"/>
                  <include name="xdoclet-xdoclet-module-1.2.2.jar"/>
                  <include name="commons-collections.jar"/>
                  <include name="commons-logging.jar"/>
                  <include name="log4j-1.2.9.jar"/>
               </fileset>
            </classpath>         
      </taskdef>
      <!-- Execute the hibernatedoclet task -->
      <hibernatedoclet
         destdir="${dist}"
         excludedtags="@version,@author,@todo"
         force="true"
         mergedir="${dist}"
         verbose="true">
         <fileset dir="${pojoFiles.dir}">
            <include name="**/*.java"/>
         </fileset>
         <hibernate version="2.0"/>
      </hibernatedoclet>         
   </target>


----
AppUser.java
----

Code:
/**
* @hibernate.class table="APPUSER"
*/
public class AppUser {
   
   private String userID;
   private String firstName;
   
   /**
    * @hibernate.property column="FIRSTNAME" type="string" length="30" not-null="false"
    * @return Returns the firstName.
    */
   public String getFirstName() {
      return firstName;
   }

   public void setFirstName(String firstName) {
      this.firstName = firstName;
   }
   
   /**
    * @hibernate.id column="ID" type="string" length="30" unsaved-value="null" generator-class="assigned"
    * @return Returns the userID.
    */
   public String getUserID() {
      return userID;
   }
   
   public void setUserID(String userID) {
      this.userID = userID;
   }
}


Hibernate version: 2.1.7c
XDoclet version: 1.2.2


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 05, 2004 6:15 pm 
Beginner
Beginner

Joined: Tue Oct 26, 2004 12:45 pm
Posts: 43
Location: Israel
Hi.

I think it needs to have your *.class in its ant classpath, and not the sources.

Is this the case here?

Jus.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 06, 2004 10:11 am 
Newbie

Joined: Tue Nov 30, 2004 5:07 am
Posts: 14
According to http://www.hibernate.org/72.html (search for "*.java") it needs the sources, not the class-files.

However, I know that I should compile the java-files to ensure that there are no major problems (and I do so). But I think for creating the hbm-files these class-files are not needed.

smo


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 07, 2004 5:42 am 
Newbie

Joined: Tue Nov 30, 2004 5:07 am
Posts: 14
Ok, I've downloaded an example for XDoclet with hibernate http://www.hibernate.org/hib_docs/online/workshop_toolset/workshop_toolset_java.tar.gz and tried to build it (with <project name="workshop-toolset" default="topdown.xdoclet">).

Still the same problem: Not *hbm.xml-files generated:

Code:
d:\test> ant -buildfile build.xml
Buildfile: build.xml

topdown.xdoclet:
[hibernatedoclet] [XDocletMain.start             47   ) Running >hibernate/>

BUILD successfull
Total time: 3 seconds


I made Windows search the whole directory for *.hbm.xml-files -> no files found.

Anything about my configuration that may cause this problem?
- Java 1.5.0-b64
- ant 1.6.2
- Windows XP - SP2

smo


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 07, 2004 12:36 pm 
Newbie

Joined: Tue Nov 30, 2004 5:07 am
Posts: 14
Ok, the next small steps..

My main mistake was setting the wrong path to my sources. Instead of "WEB-INF/src" I took "WEB-INF/src/com/mine/myApp/packageOne". It seems that XDoclet just searches for all classes in my Application that contain hibernate-XDoclet-tags?

To ensure that only all classes in a specific package would be affected I did:

Code:
<fileset dir="WEB-INF/src">
  <include name="**/specificPackage/*.java">
</fileset>



smo


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 07, 2004 5:48 pm 
Beginner
Beginner

Joined: Wed Oct 01, 2003 3:57 am
Posts: 33
Location: Alpharetta, Georgia
XDoclet will search through ALL of your java files in the specified file set.
Generally I have a root source directory, called src actually, right off of the base directory ${basedir}
Under src I divide into
Quote:
java
resources
configuration

etc.

As might be seen in an ant build.xml:

java.src.dir=${basedir}/src/java

<fileset dir="${basedir}/src/java">
<include name="**/*.java"/>
</fileset>

Let ant and xdoclet deal with sorting out the files that are and are not of interest to XDoclet.

XDoclet will write out the hbm.xml files into a directory structure exactly matching their package names, ie, for a class named SomeBlah.java:
Code:
package com.blah;
/**
* @hibernate.class
*/
public class SomeBlah {
  protected Long id;
 
  /**
    * @hibernate.id
   */
  public void setId(Long id) {
    this.id = id;
  }

  public Long getId() {
    return this.id;
  }
}

will be written into your target/com/blah.

I think it's also a good idea to set a value such as:
xdoclet.target.dir=${basedir}/target/xdoclet
and in some common init task prior to executing xdoclet you will create that directory.
You can include that directory in your java builds, jar builds, you can copy these generated-source files anywhere you like.[/code]


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.