-->
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: Use Hibernate tools with Spring configuration?
PostPosted: Wed Jun 03, 2009 2:53 pm 
Newbie

Joined: Sat Aug 04, 2007 6:07 pm
Posts: 6
Is there any way to use hibernate tools with a spring configured hib setup? I just want to generate a DB schema (to a file) based on my annotated classes. Right now to do this I have to maintain a duplicate .hbm.xml config file.


thanks,
Pat Niemeyer


Top
 Profile  
 
 Post subject: Re: Use Hibernate tools with Spring configuration?
PostPosted: Wed Jun 03, 2009 5:08 pm 
Beginner
Beginner

Joined: Mon Jun 01, 2009 5:39 am
Posts: 34
Use a Configuration object to create a SchemaExport task:

Code:
final Configuration cfg = new Configuration().configure("/the/hbm.xml/file");

cfg.buildMappings();

final SchemaExport xp = new SchemaExport(cfg);

xp.setOutputFile("/the/file/name");

xp.execute(true, false, false, false);


edit: sorry, I misread... You'd need to do it from an AnnotationConfiguration instead, but the SchemaExport task doesn't support those :(


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.