-->
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.  [ 2 posts ] 
Author Message
 Post subject: hbm2java from java code
PostPosted: Mon Jul 31, 2006 1:24 pm 
Newbie

Joined: Mon Jul 31, 2006 1:14 pm
Posts: 1
Hey i appreciate if someone could help me with this

I'm trying to run hbm2java task from Java code but i got nothing

here's the code

Project p = new Project( );
p.setBaseDir( new File( "." ) );

HibernateToolTask taskHibernate = new HibernateToolTask( );

taskHibernate.setProject( p );
taskHibernate.setDestDir( new File( PROPERTY_HIBERNATE_XML_GEN_URL_BIN ) );

Path pathAnt = taskHibernate.createClasspath( );

FileSet fs = new FileSet( );
fs.createInclude( ).setName( "**/*.hbm.xml" );
fs.setDir( new File( PROPERTY_HIBERNATE_XML_GEN_URL ) );
pathAnt.addFileset( fs );

ConfigurationTask cf = taskHibernate.createConfiguration( );

cf.setPropertyFile( new File( PROPERTY_HIBERNATE_PROPS_URL ) );
cf.setProject( p );

taskHibernate.setDestDir( new File( PROPERTY_HIBERNATE_XML_GEN_URL_BIN ) );

Hbm2JavaExporterTask hbm2java = ( Hbm2JavaExporterTask )taskHibernate.createHbm2Java( );

hbm2java.setJdk5( true );
hbm2java.setEjb3( false );
hbm2java.setTemplatePath( pathAnt );
hbm2java.execute( );

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 31, 2006 3:14 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i don't really support the direct ant api, but shouldn't you execute the taskHibernate instead of the individual exporter ?

_________________
Max
Don't forget to rate


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