-->
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.  [ 3 posts ] 
Author Message
 Post subject: Create varchar without length limitation in PostgreSql
PostPosted: Wed Aug 27, 2008 3:26 am 
Newbie

Joined: Wed Aug 27, 2008 3:07 am
Posts: 2
Hi,

I am using Hibernate Annotations together with PostgreSql 8.1. The DB-Entities are created or updated with hibernate.hbm2ddl.auto=update.

My problem is that I want to create a varchar-field with no length limitation (just type varchar), but if I do not use the length attribute of @column in my persistent class, Hibernate creates a varchar with default length of 255.

I do not want to use the length attribute as I do not know how much text there will be to store - and if I set length to a rather high value (e.g. 10000000), PostgreSql allocates exactly that amount of diskspace - and I would like to avoid that but rather have it in a more dynamic way (=> varchar)

Any help is welcome!


Regards,
Karsten


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 27, 2008 6:11 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

have you tried the @Lob annotation? For postgres this will map to the 'text' column type which might be what you want.

--hardy


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 27, 2008 8:34 am 
Newbie

Joined: Wed Aug 27, 2008 3:07 am
Posts: 2
That seems to do it as well,
thank you!


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