-->
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: Can you auto generate hbm.xml files?
PostPosted: Tue May 12, 2009 9:59 am 
Newbie

Joined: Tue May 12, 2009 9:52 am
Posts: 1
I'm working on a new project an have written all my classes but was hoping to have hibernate generate the xml files and create the database tables for me.

however using the latest tools in eclipse i can't seem to figure out how to do that. the code generation with a mapper exporter do sent create anything. and selecting new hbm.xml and then a class only creates a basic xml header.

does hibernate have any auto-generate tools or am i stuck writing all the xml files by hand?


Top
 Profile  
 
 Post subject: Re: Can you auto generate hbm.xml files?
PostPosted: Wed May 13, 2009 5:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
You have two choices both involve adding extra attributes to your java domain code.
1) XDoclet - Processes the domain to generate the XML files. Works well though not actively being maintained. This is because option 2.
2) Java 5 Hibernate/JPA markup. The advantage here is there is no generate step necessary since you are no longer using the XML mappings at all.

Hope this points you in the right direction.


Top
 Profile  
 
 Post subject: Re: Can you auto generate hbm.xml files?
PostPosted: Wed May 13, 2009 3:51 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
SpinningCone wrote:
I'm working on a new project an have written all my classes but was hoping to have hibernate generate the xml files and create the database tables for me.

however using the latest tools in eclipse i can't seem to figure out how to do that. the code generation with a mapper exporter do sent create anything. and selecting new hbm.xml and then a class only creates a basic xml header.

does hibernate have any auto-generate tools or am i stuck writing all the xml files by hand?


In the latest release we got support for adding JPA annotations to existing classes (Source > Generate JPA Annotations).
In the nightly build of JBoss Tools/Hibernate Tools we got support for generating hbm.xml for existing classes (New hbm.xml mapping).

Try it out ;)

BUT remember this is just the first step - don't use it as a automatic mapping method. You need to optimize it for production.

_________________
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.  [ 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.