-->
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.  [ 13 posts ] 
Author Message
 Post subject: Am I an idiot?
PostPosted: Thu Apr 29, 2004 1:28 pm 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
I'm trying to use the hibernate/jboss and xdoclet/hibernate tutorials to create simple .hbm.xml files. Although jboss-service.xml gets created, the .hbm.xml file doesn't. Getting this to work is a real time-killer. I would greatly appreciate someone pointing out my mistake. I posted the important stuff down below. Many thanks to all who try.

Regards,
Itchy



HERE ARE THE TUTORIALS that I mentioned:

http://hibernate.bluemars.net/72.html
http://www.hibernate.org/66.html





HERE IS PART OF MY build.xml (only the important stuff):
<property name="build.hibernate" location="${build.resources}/hibernate/com/sar/hibernate"/>
<property name="src.business" location="${src}/business/com/jzudi/business"/>


<target name="xdoclet" depends="jar"
description="Generates Hibernate class descriptor files.">

<!-- Defines the hibernatedoclet task for generating JBoss-Service -->
<taskdef name="hibernatedoclet"
classname="xdoclet.modules.hibernate.HibernateDocletTask">
<classpath refid="xdoclet.classpath"/>
</taskdef>

<!-- Execute the hibernatedoclet task -->
<hibernatedoclet
destdir="build.hibernate"
excludedtags="@version,@author,@todo"
force="true"
verbose="true"
mergedir="build.hibernate">

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

<hibernate version="2.0"/>
</hibernatedoclet>


</target>




HERE IS MY CLASS:

package com.jzudi.business;

import java.util.Set;
import java.util.Collections;

/** A business entity class representing an Unternehmen.
*
* @author IO
* @since 1.0
* @hibernate.class table="Unternehmens"
*/


public class Unternehmen {

private String unternehmenID;
private String unternehmenName;
private String ansprechspartner;
private String strasse;
private String plz;
private String ort;

/** The customer's orders set.*/
private Set unternehmens = Collections.EMPTY_SET;

/** The default construtor for Hibernate to instantiate with.*/
public Unternehmen(){
}


/** The getter method for the Unternehmens.
*
* @hibernate.set role="unternehmens"
*
* @hibernate.collection-key column="<UNTERNEHMEN_ID"
*
* @hibernate.collection-one-to-many class="Unternehmen"
*/

public Set getUnternehmens() {
return(unternehmens);
}

/** The setter method for this Customer's orders.*/
public void setUnternehmens(Set object) {
unternehmens = object;
}



/**
* @hibernate.id generator-class="native" type="string" column="Unternehmen_ID"
* @return String
*/
public String getUnternehmenID() {
return (unternehmenID);
}


/**
* @hibernate.property column="Unternehmen_Name" type="string"
* @return String
*/

public String getUnternehmenName() {
return (unternehmenName);
}
/**
* @hibernate.property column="Ansprechspartner" type="string"
* @return String
*/

public String getAnsprechspartner() {
return (ansprechspartner);
}

/**
* @hibernate.property column="Strasse" type="string"
* @return String
*/

public String getStrasse() {
return (strasse);
}

/**
* @hibernate.property column="PLZ" type="string"
* @return String
*/

public String getPLZ() {
return (plz);
}
/**
* @hibernate.property column="Ort" type="string"
* @return String
*/

public String getOrt() {
return (ort);
}


/**
* @param string
*/

private void setUnternehmenID(String string) {
unternehmenID = string;
}

/**
* @param string
*/

public void setUnternehmenName(String string) {
unternehmenName = string;
}

/**
* @param string
*/

public void setAnsprechspartner(String string) {
ansprechspartner = string;
}

/**
* @param string
*/

public void setStrasse(String string) {
strasse = string;
}

/**
* @param string
*/

public void setPLZ(String string) {
plz = string;
}


/**
* @param set
*/

public void setOrt(String string) {
ort = string;
}

}


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 01, 2004 12:39 pm 
Regular
Regular

Joined: Mon Oct 06, 2003 1:59 am
Posts: 52
Hi,

Code:
<hibernatedoclet
destdir="build.hibernate"
excludedtags="@version,@author,@todo"
force="true"
verbose="true"
mergedir="build.hibernate">


this seems to be wrong for me. Try this:

Code:
<hibernatedoclet
destdir="${build.hibernate}"
excludedtags="@version,@author,@todo"
force="true"
verbose="true"
mergedir="${build.hibernate}">


use the ant <echo> tag to verify all you configured properties. You always refer properties with ${property.name} within ant.

My recomendations:

1) Read a ant tutorial. Get familar with it. It's great
2) Read a xdoclet tutorial.


[/code]

_________________
"Wisest of the Maia was Ol


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 01, 2004 12:41 pm 
Regular
Regular

Joined: Mon Oct 06, 2003 1:59 am
Posts: 52
BTW it's not a good idea to mix German and English phrases. This is awfull to read. Use http://dict.leo.org if you need a good dictionary.[/url]

_________________
"Wisest of the Maia was Ol


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 1:19 pm 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
tradem,

Thanks for your ideas. I've been trying many things for the past several weeks, but no luck yet. I have to say that creating a Hibernate application that runs on JBoss is like sorting through a train wreck. There are so many scattered bits of documentation and examples that need to be fused together.

One of these months I hope to actually write some business code. In the meantime, I do appreciate your help.

Itchy


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 1:23 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Better documentation for JBoss and Hibernate is definitely high on the TODO list. Volunteers are welcome.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 2:04 pm 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
Christian Bauer,

I think merging the two products seems like a great decision. That is something that I'm sure you already know. But you need an idiot's guide for getting started. For example, I am trying to impliment Session Bean--calls-->DAO--calls-->Hibernate on JBoss. Luckily, I found a post on this forum that includes an example. Unfortunatly, as my post indicates, XDoclet isn't creating my hbm files. It also doesn't produce complete session bean descriptors. This attempt is really eating lots of time. A complete end-to-end example would be a big help.

As for purchasing support, at this point we are too low-budget for that. In fact, I'm spending lots of my own time trying to sort through all of this. Perhaps we'll discuss that in the future.

Regards,
Itchy


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 2:06 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
I'm not really talking about integration of Hibernate _into_ JBoss, I think we need more documentation how to simply _use_ Hibernate with JBoss. But I'm so busy and really burned out writing documentation and books, so it has to wait.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 15, 2004 12:40 am 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
ItchyOinker wrote:
Unfortunatly, as my post indicates, XDoclet isn't creating my hbm files. It also doesn't produce complete session bean descriptors.


So, your problem is not JBoss or Hibernate, it is XDoclet.

Did you try tradem's suggestions? What output did you get from Ant?


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 17, 2004 8:23 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
sgwood,

I did try using echo to verify my directory path settings. The output is as follows:

xdoclet:
[echo] Path : D:\jZUDIApp\MiddleTier\src\hibernate
[echo] Path : D:\jZUDIApp\MiddleTier\build\mappings

They paths are correct. I can't think of any other ways to use echo statements that would pertain. This is the only output that is produced--the XDoclet doesn't seem to run.

I have the following system variables set:
XDOCLET_HOME = F:\xdoclet121\lib
CLASSPATH = F:\Hibernate21; C:\j2sdk14204\lib\tools.jar


Top
 Profile  
 
 Post subject: My complete build.xml
PostPosted: Mon May 17, 2004 8:29 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
Here is the complete build.xml file in case you are interested...




<!-- this file uses Apache Ant 1.5.3 beta 1 -->
<project name="jZUDI-MiddleTier" default="hibernate-sar" basedir=".">

<description>
The jZUDI Business Components
</description>


<!-- set global properties for this build -->
<property name="version" value="1.0"/>
<property name="lib" location="lib"/>
<property name="src" location="src"/>
<property name="src.hibernate" location="${src}/hibernate/"/>
<property name="src.ejb" location="${src}/ejb"/>
<property name="build" location="build"/>
<property name="build.hibernate" location="${build.resources}/hibernate/"/>
<property name="build.mappings" location="${build}/mappings"/>
<property name="build.meta" location="${build}/META-INF"/>
<property name="build.doc" location="${build}/doc"/>
<property name="build.lib" location="${build}/lib"/>
<property name="dist" location="dist"/>
<property name="jar" location="jar"/>
<property name="temp" location="temp"/>

<property name="hibernate.jndi.name" value="java:/jZUDIHibernateFactory"/>
<property name="hibernate.datasource.name" value="java:/jdbc/DataSource"/>
<property name="hibernate.dialect" value="net.sf.hibernate.dialect.SAPDBDialect"/>


<!-- The location where your xdoclet jar files reside -->
<path id="xdoclet.classpath">
<fileset dir="F:\XDoclet121\lib">
<include name="*.jar"/>
</fileset>
</path>

<!-- The location where your hibernate jar files reside -->
<path id="hibernate.classpath">
<fileset dir="F:\Hibernate21\lib">
<include name="*.jar"/>
</fileset>
</path>

<target name="clean" description="removes all directories related to this build">
<delete dir="${dist}"/>
<delete dir="${jar}"/>
<delete dir="${temp}"/>
<delete dir="${build}"/>
</target>

<!-- XXXXXXXXXXXXXXXXXXXXXXXXX init XXXXXXXXXXXXXXXXXXXXXXXXXXXXXx-->

<target name="init" depends="clean" description="Initializes properties that are used by other targets.">
<property name="dist" value="dist"/>
<!-- Create the time stamp -->
<tstamp>
<format property="DSTAMP" pattern="ddMMMyyyy"/>
<format property="TSTAMP" pattern="HHmmss"/>
</tstamp>
<property name="now" value="${DSTAMP}-${TSTAMP}"/>
</target>

<!-- XXXXXXXXXXXXXXXXXXXXXXXXX prepare XXXXXXXXXXXXXXXXXXXXXXXXXXXXXx-->

<target name="prepare" depends="init" description="creates directories">
<echo message="Creating required directories..."/>
<mkdir dir="${dist}"/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${temp}"/>
<mkdir dir="${jar}"/>
<mkdir dir="${build}"/>
<mkdir dir="${build}/lib"/>
<mkdir dir="${build}/META-INF"/>
<mkdir dir="${build.mappings}"/>
<mkdir dir="${build.doc}"/>
</target>


<!-- XXXXXXXXXXXXXXXXXXXXXXXXX compile XXXXXXXXXXXXXXXXXXXXXXXXXXXXXx-->
<target name="compile" depends="prepare">
<javac srcdir="${src}/" destdir="${build}" deprecation="on" debug="on"/>
</target>

<!-- XXXXXXXXXXXXXXXXXXXXXXXXX javadoc XXXXXXXXXXXXXXXXXXXXXXXXXXXXXx-->
<!-- Javadoc
<target name="javadoc" depends="compile">
<javadoc sourcepath="${server-src}" sourcefiles="*" destdir="${build}/doc"/>
<javadoc sourcepath="${client-src}" sourcefiles="*" destdir="${build}/doc"/>
</target>
-->

<!-- XXXXXXXXXXXXXXXXXXXXXXXXX XDoclet XXXXXXXXXXXXXXXXXXXXXXXXXXXXXx-->

<target name="xdoclet" depends="compile"
description="Generates Hibernate class descriptor files.">


<!-- Defines the hibernatedoclet task for generating JBoss-Service -->
<taskdef
name="hibernatedoclet"
classname="xdoclet.modules.hibernate.HibernateDocletTask">
<classpath refid="xdoclet.classpath"/>
</taskdef>

<echo message="Path : ${src.hibernate}"/>
<echo message="Path : ${build.mappings}"/>


<!-- Execute the hibernatedoclet task -->
<hibernatedoclet
destdir="${build.mappings}"
excludedtags="@version,@author,@todo"
force="true"
verbose="true"
mergedir="${build.mappings}">

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

<hibernate version="2.0"/>
</hibernatedoclet>
<!--
<jbossservice
destdir="${build.meta}"
serviceName="Hibernate"
jndiName="${hibernate.jndi.name}"
dataSource="${hibernate.datasource.name}"
dialect="${hibernate.dialect}"
useOuterJoin="true"
transactionManagerStrategy="net.sf.hibernate.transaction.JBossTransactionManagerLookup"
transactionStrategy="net.sf.hibernate.transaction.JTATransactionFactory"
userTransactionName="UserTransaction"
/>
-->


<!-- Currently, XDoclet only generates Hibernate class descriptor files for Hibernate1.
To overcome this obstacle, and generate Hibernate2 class descriptor files, insert
the following task after your <hiberatedoclet> task: -->

<replace dir="${build.mappings}">
<include name="*.hbm.xml"/>
<replacefilter token="readonly" value="inverse"/>
<replacefilter token="role" value="name"/>
<replacefilter token="hibernate-mapping.dtd" value="hibernate-mapping-2.0.dtd"/>
</replace>


<taskdef
name="ejbdoclet"
classname="xdoclet.modules.ejb.EjbDocletTask"
classpathref="xdoclet.classpath"
/>

<tstamp>
<format property="TODAY" pattern="d-MM-yy"/>
</tstamp>

<ejbdoclet
destdir="${build.meta}"
excludedtags="@version,@author"
addedtags="@xdoclet-generated at ${TODAY}"
force="true"
ejbspec="2.0">

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

<session/>

<packageSubstitution packages="ejb" substituteWith="interfaces"/>

<localinterface pattern="{0}Local"/>
<localhomeinterface pattern="{0}LocalHome"/>
<remoteinterface pattern="{0}Remote"/>
<homeinterface pattern="{0}Home"/>


<deploymentdescriptor destdir="${build.meta}"/>
<jboss validatexml="true"
destdir="${build.meta}"
/>
</ejbdoclet>

</target>

<!-- XXXXXXXXXXXXXXXXXXXXXXXXX jar XXXXXXXXXXXXXXXXXXXXXXXXXXXXXx-->
<!-- jars compiled files and places them in appropriate directories -->
<target name="jar" depends="xdoclet">
<jar destfile="${jar}/${ant.project.name}.jar">
<fileset dir="${build}">
<exclude name="**/hibernate/**/*.class"/>
</fileset>
</jar>
</target>


<!--XXXXXXXXXXXXXXXXXXXXXX SAR for Hibernate XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->
<target name="hibernate-sar" depends="jar">
<jar destfile="${build.lib}/hibernateStartup.sar">
<fileset dir="${build.business}">
<include name="**/*.hbm.xml"/>
</fileset>
<!--
<target name="jar" depends="compile">
<jar destfile="${jar}/${ant.project.name}.jar">
<fileset dir="${build}/business"/>
</jar>
</target>
-->

<!--
<fileset dir="${lib.dir}">
<include name="cglib2.jar"/>
<include name="commons-collections.jar"/>
<include name="commons-logging.jar"/>
<include name="dom4j.jar"/>
<include name="hibernate2.jar"/>
<include name="odmg.jar"/>
<include name="ehcache.jar"/>
</fileset>
-->
<metainf dir="${build.business}">
<include name="jboss-service.xml"/>
</metainf>
</jar>

<!-- <antcall target="hibernate-schemaexport" /> -->

</target>

</project>


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 17, 2004 9:43 am 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
Your problem has been answered elsewhere on the forums.

Change:

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


to:

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


You have exactly the same problem in ejbdoclet.

If you had run Ant with a -v option on the command line, you would have seen that no java file were being processed by hibernatedoclet and ejbdoclet.


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 17, 2004 10:43 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
Using -v does provide valuable info in other areas, but the hibernatedoclet task (run from the xdoclet target) still doesn't produce much more than before:

xdoclet:
[echo] Path : D:\jZUDIApp\MiddleTier\src\hibernate
[echo] Path : D:\jZUDIApp\MiddleTier\build\mappings
Override ignored for property TODAY
Override ignored for property DSTAMP
Override ignored for property TSTAMP
Override ignored for property TODAY



Also, I did change to:

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

but nothing changed. I've previously tried every format that I could think of. It either doesn't see the files or it doesn't find XDoclet. Does the CLASSPATH and XDOCLET_HOME that I posted above look right? Do I need to include any additional references to XDoclet class files or jars in build.xml or anywhere else?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 18, 2004 10:40 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 12:45 pm
Posts: 45
That did the trick. Ulimately, I had to create a source directory that looks exactly like the build directory. I couldn't just rely on a simplified source directory structure.

ie.
D:\jZUDIApp\MiddleTier\src\com\kemaiev\jzudi\hibernate
instead of:
D:\jZUDIApp\MiddleTier\src\hibernate

Then, the fileset had to look like this:
<fileset dir="${src}">
<include name="**/hibernate/*.java"/>
</fileset>

This seems to be the only fileset format that works with XDoclet. Or at least, I couldn't find any others that worked.

Thanks a bunch sgwood and all others who posted.

Regards,
Itchy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 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.