-->
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.  [ 8 posts ] 
Author Message
 Post subject: Middlegen - version element
PostPosted: Thu Jul 22, 2004 12:09 pm 
Beginner
Beginner

Joined: Mon Jun 21, 2004 2:41 pm
Posts: 40
I am trying to get the version element to be set by middlegen. I have added a new column to my table called "version" int(4) NULL

However, when I bring up middlegen and select the table or that new column I do not see anything for the version.

What am I doing wrong?

I found this posting, http://forum.hibernate.org/viewtopic.php?t=932106&highlight=middlegen+element,
where david said that the column needs to be an int or long before the version option will show up in the GUI.

Also, when I go back to the db to change the type of the column and then go back into middlegen, middlegen is not seeing that I changed the type. Instead it is looking at the [name]-prefs.properties file. I like that I can change the hibernate.tables.sdy.base-class-name to a class that makes more sense but it would be nice if it autodetected changes for types and such.

-David


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 6:33 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Once you have the column selected then use the property combo to change the property type to version. The GUI will update the prefs file but it does not get written until middlegen is shutdown.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 6:45 pm 
Beginner
Beginner

Joined: Mon Jun 21, 2004 2:41 pm
Posts: 40
Where am I suppose to see the "property type" field?

I selected the new column that I named version. The lower GUI panel shows me specific settings for this field. The lower panel is split into two sections.
The top part is labeled "Column Mapping Attributes" and the bottom part is "Domain Property Meta Attributes"

I have checked all the drop down boxes for something that says version but there are no selections for version.

The type for the version in the database is set to "INT(4)", MS SQL, and middlegen is mapping it to Java type of java.lang.Integer which is correct.

Oh, and I do have the latest version r5 of the plugin.

Thanks David,
-David


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 8:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The type mapping needs to be int, long, or short - this will still be the java.lang.Integer in the java class. Once this is the case you will have the version option in the combo box for the property.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 23, 2004 9:57 am 
Beginner
Beginner

Joined: Mon Jun 21, 2004 2:41 pm
Posts: 40
David, I have tried all of the combinations that I can think of.

I have set the field, version, in the database to INT(4), SMALLINT(2) , BIGINT(8) with no luck.
In between each test I deleted the lines that refered to my table in the XXX-prefs.properties file.

But there is no Version option in the GUI.

Has anyone else had this happen to them?

Here is an image I took...
Image

-David Wilson


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 23, 2004 9:11 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
OK - see the Java Type (which is currently java.lang.Integer) change it to int.
Move off the property then back onto the property - so the GUI will reload its settings correctly for the combo box. Next go to Hibernate mapping specialty and use the drop down combo to select the version property. I just tried it here to make sure a silly bug did not slip through and its works fine.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 24, 2004 10:18 am 
Beginner
Beginner

Joined: Mon Jun 21, 2004 2:41 pm
Posts: 40
Oh ok. I've got it now. It was the having to click on another table then go back to the version column that I did not do.

Is there a way to say ... make all columns named "version" be set to the <version> element in the output file?

I am going to have ~1500 tables to do this on our legacy system.

Thank you,
David


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 26, 2004 4:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The easiest way is to run a sed script (or some other type of editor) over the preferences file.


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