-->
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: Options for <hbm2java> task
PostPosted: Fri Nov 25, 2005 11:14 pm 
Newbie

Joined: Tue Nov 22, 2005 12:48 am
Posts: 8
Hello,

The Java domain code generated by <hbm2java> Ant task uses basic typed composite ids.
There is a checkbox in the arifact generation dialog of eclipse hibernate tool plugin to disable "Generate basic typed compiste ids"
Is there any method to do the same with <hbm2java>?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 26, 2005 1:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
hbm2java will generate the approrpiate code for the HBM documents arrangement. If it has composite keys with a separate key mapped as such then you will get the appropriate Java generated. Best bet is to try it out and see what get generated.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 26, 2005 3:02 am 
Newbie

Joined: Tue Nov 22, 2005 12:48 am
Posts: 8
thanks david,
I use <hbm2hbmxml> to re-engineer the hbm.xml files from a database connection.
Could I configure it to generate generate the following mapping

-----------------------------------------------------------------------
<composite-id name="id" class="project.db.TbMatchingId">
<key-many-to-one name="tbCategory" class="project.db.TbCategory">
<column name="category_id" />
</key-many-to-one>
<key-many-to-one name="tbDocument" class="project.db.TbDocument">
<column name="doc_id" />
</key-many-to-one>
</composite-id>
------------------------------------------------------------------------
instead of
------------------------------------------------------------------------
<composite-id name="id" class="project.db.TbMatchingId">
<key-property name="categoryId" type="long">
<column name="category_id" />
</key-property>
<key-property name="docId" type="long">
<column name="doc_id" />
</key-property>
</composite-id>
---------------------------------------------------------------------------


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 26, 2005 5:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the checkbox in eclipse is used by jdbcconfiguration which is the guy doing the actual reverse engineering from the database to the hbm (hibernate meta model)

(hbm2hbmxml, hbm2java etc. is just "dumping" whatever that is inside this hbm)

The option for disabling basic typed composite ids is not exposed on ant since I don't really think it is a good option (key-many-to-one has downsides and if it its "too-easy" to get people might forget ;)

...but i also like to provide options, but then we must at least find a better shorthand name i think ;)

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