-->
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: How does hibernate handle Strings internally?
PostPosted: Wed Oct 27, 2004 4:04 pm 
Newbie

Joined: Tue Oct 26, 2004 2:12 am
Posts: 11
Hibernate version: 2.1.6

When I select * from the table with 9700 records, there is a huge amount of memory taken up - 40MB. (Infact I am impressed that hibernate does all this in 2.4 seconds!) Each record can have a 'comment' field which is varchar(2000), although there is often very little in the field. I see in the .hbm that the field is defined as a java.lang.String, length 2000. What does hibernate do - does it always allocate a length of 2000 in a StringBuffer or something? Does it need to know this length for efficiency of internal processing (?) because you don't normally specify the length of Strings...

TIA


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 27, 2004 4:24 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
The length attribute is only used for generating SQL for automatic schema generation. It is not used to allocate any StringBuffers. - You can always look at the code if you want to know such things, this is open source you know ;)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 27, 2004 5:07 pm 
Newbie

Joined: Tue Oct 26, 2004 2:12 am
Posts: 11
michael wrote:
...You can always look at the code if you want to know such things, this is open source you know ;)


That is true, but I do not have the time to spare to go through hibernate source code (that's one big reason for why I'm using hibernate ;-) ) - and I don't know if this would take minutes or hours. Probably hours for me, heh heh.
I do sympathise - I also contribute to open source :)


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.