• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

issue with Xdocler Ant Task

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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.
 
HariHaran Rama
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
reply
    Bookmark Topic Watch Topic
  • New Topic