-->
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: how to declare long text column in hbm?
PostPosted: Wed Jul 04, 2007 10:48 pm 
Beginner
Beginner

Joined: Thu May 17, 2007 2:41 pm
Posts: 48
I have been mapping java String to varchar(255) in mysql using


<property name="queryString" column="queryString" />
in the hbm.

Now for the first time, I need a longer data length. How do I specify that?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 05, 2007 8:49 am 
Regular
Regular

Joined: Mon Jun 12, 2006 5:33 am
Posts: 63
Hi bhomass,

you don't have to specify the length in .hbm.xml, unless you need a fixed length. Then you could write :
Code:
<property name="queryString" column="queryString"  length="2000"/> 

_________________
chucky

Don't forget to rate if this helps
-----------------------------------


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 05, 2007 8:49 am 
Regular
Regular

Joined: Mon Jun 12, 2006 5:33 am
Posts: 63
Hi bhomass,

you don't have to specify the length in .hbm.xml, unless you need a fixed length. Then you could write something like:
Code:
<property name="queryString" column="queryString"  length="2000"/> 

_________________
chucky

Don't forget to rate if this helps
-----------------------------------


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 05, 2007 6:58 pm 
Beginner
Beginner

Joined: Thu May 17, 2007 2:41 pm
Posts: 48
that seems to have had an effect. however, the data type in mysql is now text instead of varchar(2000). is 2000 simply too big for varchar? do you know off hand the cost of using text vs. varchar?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 06, 2007 4:45 am 
Regular
Regular

Joined: Mon Jun 12, 2006 5:33 am
Posts: 63
hi bhomass,

2000 was just an example. Use the length that you need.

_________________
chucky

Don't forget to rate if this helps
-----------------------------------


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 06, 2007 6:44 am 
Newbie

Joined: Thu Jul 05, 2007 12:20 pm
Posts: 3
Location: Vargem Grande do Sul, SP, BRAZIL!
Hi!

If you are using annotations, you can use

Code:
@Column(columnDefinition="LONGTEXT")


I donĀ“t know, but I think that may be exist a way to change de column definition when you use xmls to configure your entities.

Bye!

_________________
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." (Fowler)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 06, 2007 1:06 pm 
Beginner
Beginner

Joined: Thu May 17, 2007 2:41 pm
Posts: 48
I know 2000 is just an example, and I am using it as just an example. the real question is why I don't get varchar(2000).

but thanks for the tip.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 23, 2007 11:52 am 
Newbie

Joined: Thu Dec 08, 2005 11:44 am
Posts: 5
Because the max size for a varchar is 255?

_________________
Cheers
Tracey


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.