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.