aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes issue with Xdocler Ant Task Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "issue with Xdocler Ant Task " Watch "issue with Xdocler Ant Task " New topic
Author

issue with Xdocler Ant Task

HariHaran Rama
Greenhorn

Joined: Mar 20, 2008
Posts: 5
Hi All,

i have the following ANT target , by which i am trying to generate hbm.xml files from my model java classes. when i run the target, it runs successfully but i don;t see any hbm.xml files being generated. Can you please let me know if there is anything wrong here.

xdoclet.classpath has the folder where i have all the jars, needed.

<target name="hibdoc"
depends="init,compile"
description="Generate Persistence and form classes">
<taskdef
name="xdoclet"
classname="org.xdoclet.ant.XDocletTask"
classpathref="xdoclet.classpath"
/>
<xdoclet verbose="true">
<!-- defines the file handled by xdoclet2 -->
<fileset dir="${bsdrdir}\src">
<include name="*.java"/>
</fileset>
<!-- defines the processing of a plugin -->
<component
classname="org.xdoclet.plugin.hibernate.HibernateMappingPlugin"
destdir="."
version="3.0"
/>
</xdoclet>
</target>
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10202
    
166



Are you sure, the task is picking up the java files? Also, i guess the include should be:



to ensure that java files in the subfolders are picked up.


[My Blog] [JavaRanch Journal]
HariHaran Rama
Greenhorn

Joined: Mar 20, 2008
Posts: 5
Thanks JaiKiran for the response,

I did confirm that its picking the java files, if i remove from the model classes/java files from the source folder, i get the following error.

hibdoc:
[xdoclet] Running org.xdoclet.plugin.hibernate.HibernateMappingPlugin
[xdoclet] Metadata was empty. Got metadata from org.xdoclet.QDoxMetadataProvider@193a66f

once i have the files back in source folder, it works fine, i have now corrected my build file to have **/*.java as per your suggestion, but still no hibernate mapping files are being generated.

foot note : your blog is really help full and has a wealth of info, thanks for being such a great help to many of us. appreciate your help

thanks
Hari
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10202
    
166

Originally posted by HariHaran Rama:
but still no hibernate mapping files are being generated.



Are you sure you are looking at the correct folder for the hbm file? Also, can you post the code in one of your Hibernate POJO files, for which you are trying to generate the hbm?

P.S: The Ant tasks in Hibernate tool project are more used these days, than XDoclet.
HariHaran Rama
Greenhorn

Joined: Mar 20, 2008
Posts: 5
Hi Jaikiran

Please find the POJO and corrsponding hbm file below that i am using.



public class Roles {

private int roleid;
private String rolename;
private String description;
private int deleted_flg;
private String scope;

public Roles() {


}
public Roles(int roleid, String rolename, String description,int deleted_flg,String scope) {

this.roleid = roleid;
this.rolename = rolename;
this.description = description;
this.deleted_flg = deleted_flg;
this.scope = scope;
}

/** The getter method for this Deleted Flag
*
* @hibernate.property
*/
public int getDeleted_flg() {
return deleted_flg;
}
/**
* @param deleted_flg the deleted_flg to set
*/
public void setDeleted_flg(int deleted_flg) {
this.deleted_flg = deleted_flg;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}

/** The getter method for this Role's identifier.
*
* @hibernate.id generator-class="native"
*/
public int getRoleid() {
return roleid;
}
/**
* @param roleid the roleid to set
*/
public void setRoleid(int roleid) {
this.roleid = roleid;
}
/** The getter method for this Role's name
*
* @hibernate.property
*/
public String getRolename() {
return rolename;
}
/**
* @param rolename the rolename to set
*/
public void setRolename(String rolename) {
this.rolename = rolename;
}

/** The getter method for this Scope's name
*
* @hibernate.property
*/
public String getScope() {
return scope;
}
/**
* @param scope the scope to set
*/
public void setScope(String scope) {
this.scope = scope;
}



}

--------------------------------------------------------------------------
roles.hbm.xml
--------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

<class name="com.miletag.server.persist.Roles" table="ROLES" >

<id name="roleid" column="ROLEID" >
<generator class="native"/>
</id>

<property name="rolename" type="java.lang.String" column="ROLENAME" />

<property name="description" type="java.lang.String" column="DESCRIPTION" />

<property name="deleted_flg" type="int" column="DELETED_FLG" />

<property name="scope" type="java.lang.String" column="SCOPE" />

</class>
</hibernate-mapping>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: issue with Xdocler Ant Task