-->
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: Versionning field missed when generating with middlegen
PostPosted: Fri Jun 25, 2004 12:01 pm 
Beginner
Beginner

Joined: Fri Jun 25, 2004 11:47 am
Posts: 34
Hi,
I currently have the following table :

CREATE TABLE CONTACT (
CONTACT_ID BIGINT NOT NULL AUTO_INCREMENT,
FIRST_NAME VARCHAR(255) NOT NULL,
LAST_NAME VARCHAR(255) NOT NULL,
MIDDLE_NAME VARCHAR(255) NULL,
BIRTHDAY DATETIME NULL,
SOCIAL_ID VARCHAR(255) NULL,
VERSION INT NULL,
PRIMARY KEY(CONTACT_ID)
)
TYPE=InnoDB;

I would like to render the datafield VERSION to the following hbm declaration when I use middlegen :

<version name="version" type="java.lang.Integer" column="VERSION">
<meta attribute="field-description">
@hibernate.version
column="VERSION"
</meta>
</version>

I've seen there is a declaration for that in the velocity template (hibernate.vm) but it seems it's not used.
I think I'm missing something, could you tell me what...
Thanks

The hibernate version is 2.1.4.
Middlegen version 2.1


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 25, 2004 11:19 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
It works fine but the version option is only shown when you have certain types setup for the property. Try setting the type to int, or long and see if that works for you.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 26, 2004 5:18 am 
Beginner
Beginner

Joined: Fri Jun 25, 2004 11:47 am
Posts: 34
Hi,

I've changed the type for the version field in the database to INT(9) which is converted to java.lang.Integer and also to BIGINT(18) which is converted to java.lang.Long and I've also tried with sql type NUMERIC. But the mapping is always Long or Integer. How can I change that to have a primitive int or long.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 26, 2004 9:52 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I was not refering to the database type. In middlegen the GUI allows you to fine tune the type for the mapping. Change it to int or long and the Version option will be available on the Property combo.


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.