-->
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: Middlegen Code Generation
PostPosted: Mon Apr 12, 2004 9:12 pm 
Newbie

Joined: Mon Apr 12, 2004 9:08 pm
Posts: 2
Hi,

We are using middlegen to extract the hbm.xml file from a Database Table and also the corresponding java file using hbm2java but we are looking at creating only one Java file.

Right now, if we are using middlegen and hbm2java against a database table ORDER, we get Order.java and OrderPK.java and we are wondering if there is a way to generate only one file Order.java which has all the contents from both Order.java and OrderPK.java.

Is this possible by changing the template file that came with middlegen?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 14, 2004 7:21 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Middlegen does not (currently) generate any Java code. Its hbm2java that generates the java code from the hbm's that middlegen has created. You can edit the velolcity script to customise the output. Having said that, there is a Ant option documented on the wiki to generate the Composite Key as an integrated key rather than an external key. See the Middlegen Wiki page for the details.
http://hibernate.bluemars.net/98.html

Note: Integrated Composite keys is not the recommended approach.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 14, 2004 8:36 pm 
Newbie

Joined: Mon Apr 12, 2004 9:08 pm
Posts: 2
Hi,

I found a solution for my own question. In order to create only one Java File for a Database Table instead of creating two files (one seperately for Primary key), basically in your build.xml inside the middlegen target, under the hibernate plugin, just add

genIntergratedCompositeKeys="true"

This will only create one Java file

THanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 15, 2004 10:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Great - For others reference - this is in the documentation as I pointed out.


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.