-->
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: Generating POJOs from hbm.xml or hbm.xml from POJOs??
PostPosted: Sun Mar 05, 2006 10:01 am 
Newbie

Joined: Sun Mar 05, 2006 7:52 am
Posts: 4
Hi,

I have recently started working with Hibernate.

Hibernate allows us to generate source code from *.hbm.xml files and also allows us to generate *.hbm.xml files from source code (POJO classes with XDoclet tags). I would like to go with the latter because as developers we are inclined to think in terms of objects and it seems easier to me (personal opinion :-) ).

I personally like using code generation as much as possible and when it came to hibernate I was not sure which would be a better option from the two listed above.

Is it better to write the hbm.xml files and then generate java objects from it or is it better to write java objects and add XDoclet tags to generate hbm.xml files?? Is there any advantage than one approach gives us over the other? Is XDoclet robust enough to support the basic, commonly used aspects of hibernate (if not all)?

TIA,
Regards,
SK


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 05, 2006 1:18 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
depends - mostly a manner of personal taste.

hbm.xml to java - use hibernate tools, developed/supported by the hibernate team, requires some tweaking if you want to add code into the pojo's BUT it is possible and supported.

xdoclet to hbm.xml - use doclet, *not* actively developed/supported by the hibernate team, does *not* support all hibernate3 features.

You forget one alternative and that is to use Hibernate Annotations; removing any need for code generation of the beans and still allowing you to generate other code via the hibernate tools.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 05, 2006 7:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
If you choose to use Xdoclet 1.x then use the CVS version. Lots of work has been done to support the majority of H3.x features. It will be released as 1.3.x .

Annotations is worth considering if your using JDK 5 or higher.


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.