-->
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.  [ 4 posts ] 
Author Message
 Post subject: Can someone send me a complete ANT File working for JBoss ?
PostPosted: Mon May 03, 2004 9:55 am 
Newbie

Joined: Mon Apr 26, 2004 11:01 am
Posts: 12
Location: France
Hello,

I'm trying to use Hibernate with JBoss 3.2.3. I try to follow the 2nd method explained at : http://www.hibernate.org/66.html.

I don't understand all, the explanation is really poor and I don't understand Ant at all.

I'd like that someone send me a complete Ant file and tell me what are the files : "jboss-service-custom.xdt" and "hibernate-properties-*.xml" and where I could find them.

My mail is xmatsylob.com just replace at with @

Thank you for your help

_________________
Xavier MOGHRABI
http://www.enstimac.fr/~moghrabi


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 06, 2004 7:56 am 
Newbie

Joined: Thu Mar 04, 2004 11:20 am
Posts: 6
Location: Poznan, Poland
Hello

This is a fragment of my build.xml file responsible for building JBoss' SAR service for Hibernate.

I do not put my POJO classes in this archive and that is why the service is deployed properly after deploying the EAR application.

I use Hibernate 2.1.1 and JBoss 3.2.4RC1.

sincerely Olek



<!-- generate hibernate files -->
<hibernatedoclet
destdir="${build.dir}/ejb/gen"
mergedir="metadata/ejb"
excludedtags="@version,@author"
addedtags="@xdoclet-generated at ${TODAY}"
force="${xdoclet.force}"
>

<fileset dir="src/ejb"/>

<hibernate validatexml="true" version="2.0" />

<jbossservice
destdir="${build.dir}/ejb/gen"
serviceName="Hibernate"
jndiName="hibernate/sessionFactory"
dataSource="java:comp/env/jdbc/${database.name}"
dialect="${hibernate.dialect}"
useOuterJoin="false"
showSql="false"
transactionManagerStrategy="net.sf.hibernate.transaction.JBossTransactionManagerLookup"
transactionStrategy="net.sf.hibernate.transaction.JTATransactionFactory"
userTransactionName="UserTransaction"
/>


</hibernatedoclet>


<jar destfile="dist/hibernateStartup.sar">

<!-- Get the generated hbm.xml files -->
<fileset dir="${build.dir}/ejb/gen">
<include name="**/*.hbm.xml"/>
</fileset>


<fileset dir="${hibernate.dir}/lib">
<include name="cglib2.jar"/>
<include name="dom4j.jar"/>
<include name="odmg.jar"/>
<include name="ehcache.jar"/>
</fileset>

<fileset dir="${hibernate.dir}">
<include name="hibernate2.jar"/>
</fileset>


<fileset dir="${lib.dir}/jakarta-struts-20031202/lib">
<include name="commons-collections.jar"/>
<include name="commons-logging.jar"/>

</fileset>


<metainf dir="${build.dir}/ejb/gen">
<include name="jboss-service.xml"/>
</metainf>

</jar>


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 07, 2004 8:41 am 
Newbie

Joined: Mon Apr 26, 2004 11:01 am
Posts: 12
Location: France
Thank you Olekg for your help.

I need more explanation about the construction of the jboss-service.xml.

I want to use xdoclet and the ant task just for generating the jboss-service.xml file (not the mapping *.hbm.xml). So I wrote the following task based on the Olekg's one. The file is generated, but it contains an empty line of MapResources. I would like that the names of my mapping files could be included in the MapResources. Do you know how I can do this ?

Here is my ant task :

Code:
<target name="sar" description="Construction d'hibernate.sar">
      <delete file="META-INF/jboss-service.xml"/>
      <taskdef name="hibernatedoclet"   classname="xdoclet.modules.hibernate.HibernateDocletTask" classpath="D:/xdoclet-1.2/lib/">
      <classpath >
         <fileset dir="D:/xdoclet-1.2/lib">
          <include name="*.jar"/>
         </fileset>
         
      </classpath>

      
    </taskdef>
      
      <hibernatedoclet destDir="." mergedir="mappings">

      <fileset dir="."/>
      
      <hibernate validatexml="true" version="2.0" />
      
      <jbossservice
      destdir="META-INF"
      serviceName="HibernateFactory"
      jndiName="java:/hibernate/HibernateFactory"
      dataSource="java:/${database.name}"
      depends="jboss.jca:service=LocalTxCM,name=${database.name}"
      dialect="net.sf.hibernate.dialect.${hibernate.dialect}"
      useOuterJoin="false"
      showSql="true"
      transactionManagerStrategy="net.sf.hibernate.transaction.JBossTransactionManagerLookup"
      transactionStrategy="net.sf.hibernate.transaction.JTATransactionFactory"
      userTransactionName="UserTransaction"
      />
      </hibernatedoclet>
      
      <delete file="${sar.name}.sar"/>
      <jar jarfile="${sar.name}.sar" basedir=".">
         <include name="mappings/**/*.hbm.xml"/>
         <include name="META-INF/jboss-service.xml"/>
         
         <fileset dir="${hib.dir}/lib">
            <include name="cglib*.jar"/>
            <include name="dom4j*.jar"/>
            <include name="odmg*.jar"/>
            <include name="ehcache*.jar"/>
            <include name="commons-collections*.jar"/>
            <include name="commons-logging*.jar"/>
         </fileset>
         
         <fileset dir="${hib.dir}">
            <include name="hibernate2.jar"/>
         </fileset>
      </jar>
   </target>


Here is the result :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server>
<!-- Generated file - Do not edit! -->
<server>
   <mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateFactory">
       <depends>jboss.jca:service=RARDeployer</depends>
       <depends>jboss.jca:service=LocalTxCM,name=MaxdbDS</depends>
       <attribute name="MapResources"></attribute>
       <attribute name="JndiName">java:/hibernate/HibernateFactory</attribute>
       <attribute name="Datasource">java:/MaxdbDS</attribute>
       <attribute name="Dialect">net.sf.hibernate.dialect.SAPDsDialect</attribute>
       <attribute name="UseOuterJoin">false</attribute>
       <attribute name="ShowSql">true</attribute>
       <attribute name="UserTransactionName">UserTransaction</attribute>
       <attribute name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionFactory</attribute>
       <attribute name="TransactionManagerLookupStrategy">net.sf.hibernate.transaction.JBossTransactionManagerLookup</attribute>
   </mbean>
</server>


Thanks a lot.

_________________
Xavier MOGHRABI
http://www.enstimac.fr/~moghrabi


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 07, 2004 9:16 am 
Newbie

Joined: Thu Mar 04, 2004 11:20 am
Posts: 6
Location: Poznan, Poland
Hello

I think hibernatedoclet , where jbosservice task is embeded, is based on files with XDoclet tags. Where .hbm.xml files are generated, then their names are included in MapResources tag.

If you don't want to use hibernatedoclet to generate hbm.xml files I think you should try to use mergeDir attribute of jbossservice subtask. See docs at:

http://xdoclet.sourceforge.net/xdoclet/ ... bTask.html


sincerely Olek


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