-->
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.  [ 6 posts ] 
Author Message
 Post subject: SchemaUpdate Change Type Column
PostPosted: Thu Nov 24, 2005 5:05 am 
Newbie

Joined: Thu Nov 24, 2005 4:48 am
Posts: 3
Hibernate version:
Hiberntate 2.1.8
Hibernate 3.1RC3

Name and version of the database you are using:
PostGreSQL V8.0.x

Hello,

I try to use ant Task "schemaupdate" of Hiberntate archive to change type of my column.

Do you know if this functionality is avaible ?

The SQL script for this database is very simple is :

Code:
Before
For information, There is no data in my table

TABLE MYTABLE
COLUMN myColumn TYPE TEXT

ALTER TABLE MYTABLE ALTER COLUMN myColumn TYPE varchar

Do you have a solution ?

Thnks for your help
Franck


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 6:04 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
???

why two version of hibernate?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 6:10 am 
Newbie

Joined: Thu Nov 24, 2005 4:48 am
Posts: 3
Hello,

Because, I realised this test with these two versions of Hibernate. That's all.

Franck


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 12:25 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
perhaps you could try to explain what you are trying to do in a different way. how does this relate to the tools suite?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 2:24 pm 
Newbie

Joined: Thu Nov 24, 2005 4:48 am
Posts: 3
Hello,

I develop an application with Hibernate Component (version 2.1.8). I try the Hibernate to see if this problem, for me, is resolved.

So I have an objet with attributes String

Code:
public MyClass {

    private String myValue;

    /** @hibernate.property
    public String getMyValue() {return myValue;}

    public void setMyValue(String a) {myValue = a;}

}


When i use "ShemaExport" of Hibernate 2.1.8 (ant Task), i obtain this schma
TABLE MYCLASS
COLUMN MYVALUE VARCHAR(255)

In the next ieration of my application, 255 characters for my attributes, it is limited too much. So i changed my configuration of Hibernate and my new code is :

Code:
public MyClass {

    private String myValue;

    /** @hibernate.property [b]type="text"[/b]
    public String getMyValue() {return myValue;}

    public void setMyValue(String a) {myValue = a;}

}


When i use "ShemaUdpate" of Hibernate 2.1.8 (ant Task), i think this task have capacity to change property of colum. The SQL command is very simple : (for e.g. ALTER TABLE MYCLASS ALTER COLUMN myValue TYPE text )

I hope you obtain more information about my problem.

Tks for your help
Franck


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 2:31 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
in the mapping file for this class, find the property element that corresponds to this property.

what happens if you set the length attribute to something > 255 ?

Code:
<property name="foo" length="300"  />


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