-->
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: More than 255 varchar's with a string type...
PostPosted: Fri Nov 21, 2008 1:33 pm 
Newbie

Joined: Fri Nov 21, 2008 1:27 pm
Posts: 3
Hi,
I am running into problems with the StringType in Hibernate. It gets mapped (MySQLInnoDB5 Dialect) to a VARCHAR(255), however I need VARCHAR(2000) or tinytext would do.

Is there way to "globally" map any StringType within that hibernate-configuration to VARCHAR(2000)?

Thanks!

Florian


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2008 3:08 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Try setting the "length" attribute. I think the default value is 255. For example:

<property name="something" type="string" length="2000" .... />


Top
 Profile  
 
 Post subject: RE:More than 255 varchar's with a string type...
PostPosted: Fri Nov 21, 2008 3:26 pm 
Newbie

Joined: Fri Nov 21, 2008 1:27 pm
Posts: 3
Thanks but that doesn't solve my problem, need to do it globally, I am generating schemata from XSDs and cannot modify those all the time.

Found a way however, just overwriting the Dialect and registering my own column.
Code:
package de.leibert.util;

import org.hibernate.dialect.MySQL5InnoDBDialect;

import java.sql.Types;

public class FLMysqlDialect extends MySQL5InnoDBDialect{
   
   public FLMysqlDialect() {
      super();
   }
   protected void registerVarcharTypes() {
      registerColumnType( Types.VARCHAR, "longtext" );
      registerColumnType( Types.VARCHAR,  "varchar(2000)" );
   }

}


Last edited by florianl on Fri Nov 21, 2008 4:38 pm, edited 3 times in total.

Top
 Profile  
 
 Post subject: RE:More than 255 varchar's with a string type...
PostPosted: Fri Nov 21, 2008 3:26 pm 
Newbie

Joined: Fri Nov 21, 2008 1:27 pm
Posts: 3
works great


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.