-->
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.  [ 3 posts ] 
Author Message
 Post subject: Adding a hbm.xml to hibernate.cfg.xml using ANT task
PostPosted: Wed May 03, 2006 7:40 am 
Newbie

Joined: Wed May 03, 2006 7:22 am
Posts: 3
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0

Hi All,

I am facing a problem in adding a hbm.xml file to hibernate.cfg.xml file.
I have a hbm.xml file manually created and I want this file to be added to the hibernate.cfg.xml file while I am actually generating the HBM files and hibernate.cfg.xml file using ANT task.
I am using the following Hibernate Plugin to generate my HBM and hibernate.cfg.xml files


<taskdef name="xdoclet" classname="org.xdoclet.ant.XDocletTask" classpathref="xdoclet.classpath" />

<!-- generate .hbm files -->
<xdoclet verbose="false">

<!-- defines the file handled by xdoclet2 -->
<fileset dir="${project.model.package}">
<include name="model/core/*.java"/>
<include name="loanCase/*.java"/>
<include name="loanCase/caseTask/*.java"/>
</fileset>


<!-- defines the processing of the hibernate plugin -->
<component
classname="org.xdoclet.plugin.hibernate.HibernateMappingPlugin"
destdir="${project.model.package}"
version="3.0"/>

<component
classname="org.xdoclet.plugin.hibernate.HibernateConfigPlugin"
destdir="${src.dir}"
version="3.0"
properties="${project.model.package}/hibernate.build.properties"/>
</xdoclet>

Can any one please guide me how to add a hbm.xml file to the hibernate.cfg.xml file using ANT task.

Thanks in advance.

Rohit


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 19, 2006 5:19 am 
Newbie

Joined: Wed May 03, 2006 7:22 am
Posts: 3
Hi All,

I myself found the solution in one of the websites for this issue. The following is the solution:

We need to use a particular ANT task that has the provision to add the arbitarary HBM file to the hibernate.cfg.xml.

<hibernatedoclet force="true" verbose="true" destdir="${project.model.package}" >
<fileset refid="project.model.package"/>
<hibernatecfg version="3.0"
datasource="${hibernate.connection.datasource}"
dialect="${hibernate.dialect}"
showsql="false">
<otherMapping name="resource" value="${NamedQuery.hbm}"/>
</hibernatecfg>
</hibernatedoclet>

where the inner ANT task <otherMapping/> adds the arbitarary HBM file to the hibernate.cfg.xml.
${NamedQuery.hbm} is the complete defined location of the HBM file.

Thanks & Regards,

Rohit


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 30, 2007 12:18 pm 
Newbie

Joined: Fri Nov 30, 2007 12:00 pm
Posts: 1
Hi,

I know these posts are more than one year old, but they might still help me and other users.

I created a LogLevel.hbm.xml file in src/com/example which I want to include in hibernate.cfg.xml by using xdoclet.

The following piece of code should work, I think:
Code:
<hibernatecfg version="3.0" datasource="${ds}" dialect="${dialect}">
<otherMapping name="resource" value="${src}/com/example/LogLevel.hbm.xml" />
</hibernatecfg>


But when I run my hibernate config generation target, the following line is printed:
Code:
[hibernatedoclet] addOtherMapping(): name=null, null

and the mapping is not included in the hibernate.cfg.xml file. I tried with different name and value combinations (as test), but I always receive the previous 'error', even though XDoclet should complain about not finding the resource as written on http://forum.springframework.org/showpo ... ostcount=4

Anyone has an idea how to get this working?


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