-->
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.  [ 12 posts ] 
Author Message
 Post subject: Middlegen & id fields
PostPosted: Sun Apr 25, 2004 1:41 pm 
Beginner
Beginner

Joined: Fri Apr 02, 2004 3:34 am
Posts: 40
Running middlegen and using mysql-connector-java-3.0.11-stable-bin.jar against a MySQL database, I keep getting the "generator" set to "assigned".

Anyone knows how I can instruct the Hibernate plug-in to use "native" instead?

Thanks,
Acco


Top
 Profile  
 
 Post subject: Re: Middlegen & id fields
PostPosted: Sun Apr 25, 2004 1:42 pm 
Beginner
Beginner

Joined: Fri Apr 02, 2004 3:34 am
Posts: 40
My PK columns in MySQL are all auto-increment.


Acco Lade wrote:
Running middlegen and using mysql-connector-java-3.0.11-stable-bin.jar against a MySQL database, I keep getting the "generator" set to "assigned".

Anyone knows how I can instruct the Hibernate plug-in to use "native" instead?

Thanks,
Acco


Top
 Profile  
 
 Post subject: Re: Middlegen & id fields
PostPosted: Sun Apr 25, 2004 7:37 pm 
Newbie

Joined: Sat Apr 24, 2004 6:25 pm
Posts: 14
Location: Rochester, NY
Using the GUI it is possible to change the type to native, or in the middlegen prefs file I placed the following property for each table.

hibernate.tables.approval_trans.keygenerator=native

where approval_trans is the name of the table. It would be nice to be able to set a global default in the hibernate middlegen plugin.

I have used middlegen's pk generator for my CMP beans in the past, which generates the pk from a sequence name in a table, this worked great and I don't think that hibernate has something like that.

Ben


Top
 Profile  
 
 Post subject: Re: Middlegen & id fields
PostPosted: Mon Apr 26, 2004 2:53 am 
Beginner
Beginner

Joined: Fri Apr 02, 2004 3:34 am
Posts: 40
I decided to use the ANT task replace.

GUIs are out of question for me as I always start work from the database. It would be a pain to go through 500 tables and try to remember all the little modifications here and there.


ben@csh.rit.edu wrote:
Using the GUI it is possible to change the type to native, or in the middlegen prefs file I placed the following property for each table.

hibernate.tables.approval_trans.keygenerator=native

where approval_trans is the name of the table. It would be nice to be able to set a global default in the hibernate middlegen plugin.

I have used middlegen's pk generator for my CMP beans in the past, which generates the pk from a sequence name in a table, this worked great and I don't think that hibernate has something like that.

Ben


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 26, 2004 6:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Once the settings have been created and saved in the prefs file Middlegen will use those settings.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2004 11:14 pm 
Beginner
Beginner

Joined: Fri Apr 02, 2004 3:34 am
Posts: 40
I wish I could do hibernate.tables.*.keygenerator=native

:-)


david wrote:
Once the settings have been created and saved in the prefs file Middlegen will use those settings.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 28, 2004 8:14 am 
Newbie

Joined: Sat Apr 24, 2004 6:25 pm
Posts: 14
Location: Rochester, NY
The cmp plugin for middlegen allows you to pick to global pk generation, so it would be nice to do the same in the hibernate one. I am working on a couple patches for the middlegen hibernate plugin so I can probably include the capability to set the generator at a global level.

Ben


Acco Lade wrote:
I wish I could do hibernate.tables.*.keygenerator=native

:-)




Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 28, 2004 6:46 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Use sed to make the change or a small chunk of java code by reading the properties editing then and saving it again.

I would like to receive the patches once your done. If reasonable I will commit that changes. Please work off the CVS version. send patch(s) to david@hibernate.org


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 28, 2004 6:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Acco Lade wrote:
I wish I could do hibernate.tables.*.keygenerator=native

:-)


This actually is not all that difficult. If I don't get a patch I'll add it to Middlegen so you can set it using Ant Task.

Remind me in a few days.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 28, 2004 11:31 pm 
Beginner
Beginner

Joined: Fri Apr 02, 2004 3:34 am
Posts: 40
If you got the momentum going, is it possible to also add something like:

hibernate.tables.*.default-cascade="save-update" ?!?

Thanks!!!


david wrote:
Acco Lade wrote:
I wish I could do hibernate.tables.*.keygenerator=native

:-)


This actually is not all that difficult. If I don't get a patch I'll add it to Middlegen so you can set it using Ant Task.

Remind me in a few days.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 30, 2004 10:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
See what I can do.. Might have some time next week to knock it off.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 03, 2004 8:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
OK I have added the ability to set native as the default for the generator at the Ant level and also added the ability to globally set the cascade value, eg, 'save-update' or what ever.

Not in CVS as yet (I'm away at the moment seeing a client) I'll check it in at the end of the week (when I get back) + any other features I get done in the hotel in the evenings.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 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.