-->
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: Generic Exporter and hbm2x
PostPosted: Mon Oct 03, 2005 10:34 am 
Beginner
Beginner

Joined: Mon Jun 07, 2004 4:31 pm
Posts: 45
Location: France
Max,

I look up hbm2x package
A good stuff is to create a GenericTool and to put it in velocity ctx.
This tool can have basic operations such as below :

private String getMappingFileResource(PersistentClass element)
{
return element.getClassName().replace('.', '/') + ".hbm.xml";
}


this method is in HibernateConfigurationExporter.
I want to generate a file with the list of mapping file !

vm file could be like this :

#foreach($mapping in $cfg.getClassMappings())
$generictool.getMappingFileResource($mapping.className)
#end


I did not find the org.hibernate.tool.hbm2x.GenericExporter.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 03, 2005 10:44 am 
Beginner
Beginner

Joined: Mon Jun 07, 2004 4:31 pm
Posts: 45
Location: France
I did not find the org.hibernate.tool.hbm2x.GenericExporter
Sorry i began crazy i extracted 0925 build instead of 0928 ;-)


Top
 Profile  
 
 Post subject: Re: Generic Exporter and hbm2x
PostPosted: Mon Oct 03, 2005 10:47 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
jrpinna wrote:
I want to generate a file with the list of mapping file !


<cfg2cfgxml /> does this for you.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 04, 2005 5:16 am 
Beginner
Beginner

Joined: Mon Jun 07, 2004 4:31 pm
Posts: 45
Location: France
Yes i know but i want to generate a spring application context file
I do it by this vm code :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
#set( $hbmExtension=".hbm.xml" )

<!--
File : applicationContext-hibernate.xml, generated with ccip velocity custom templates : applicationContext-hibernate.vm <br>
Description : This file define the hbm files which are mapped into the session factory of hibernate
Last modification :$Date: $ <br>
@author $Author: $
@version $Revision: $
-->
<beans>

<bean id="mappingResources" class="java.util.ArrayList">
<constructor-arg>
<list>
#foreach($mapping in $cfg.getClassMappings())
$mapping.getClassName()Impl$hbmExtension
#end
</list>
</constructor-arg>
</bean>

</beans>


Then I replace the package name by the file path of the hbm

<!-- Replace package name by the file path of the hbm file in the spring generated application context -->
<target name="replace" depends="generate.java">
<replace file="${java.directory}fr/ccip/domain/impl/applicationContext-hibernate.xml" token="${package.name}." value="${package.directory}domain/impl/"/>
</target>


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.