-->
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: Auto-select generator class based on db column props?
PostPosted: Wed Jul 21, 2004 12:03 pm 
Newbie

Joined: Wed Jul 21, 2004 11:43 am
Posts: 2
Location: Stockholm, Sweden
I plan to use the the Hibernate Middlegen plugin to create hbm files from an existing database. I wish to make this process as automatic as possible, so that I can simply regenerate the mappings when the db has changed without having to use the gui or do manual changes in the hbm files.

My tables typically have a single pk column which has auto_increment set (I'm using MySQL). I figure I can change the generator class either by editing the generated properties file or by changing the default in the plugin source. However, the ultimate would be if I could keep "assigned" as the default, and automatically use "identity" for all tables where the primary key consists of a single column with identity set. Is this at all possible to do with the Middlegen plugin?

thanks,
mikael


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 21, 2004 7:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Middlegen does not know if the column is an identity column or not thus the answer is no. The best option is the preferences file - this is edited either manually or by the GUI. If you have a new table then start the GUI and set the appropriate generator (default is assigned). There is no need to start the GUI if a column is added or changed unless it has a special property for which the default value is not appropriate.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 3:32 am 
Newbie

Joined: Wed Jul 21, 2004 11:43 am
Posts: 2
Location: Stockholm, Sweden
Ok, I suspected the identity information might not be available. Preferences it is, then. Thanks.

By the way, as identity pks will be used almost in every table, is there a way of changing the default from assigned to identity other than by modifying the plugin source? (If not, that might be a pretty useful feature I think)


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.