-->
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: understanding problem: mutable in Type
PostPosted: Tue Nov 16, 2004 9:57 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
Hibernate version: 2.1.6

Hi,

perhaps a stupid question and i know i've read something about it somewhere .. either in HiA or in the ReferenceDoc but i'm not able to find it again ... therefore it would be creat if someone can give me a tip ...

I know what the flag 'mutable=false' means concerning a class-mapping. I can change my object, but the changes won't get persisted to db ...

Writing a UserType, i can set 'mutable', too. But a 'immutable' Type will still be changed in DB (see IntegerType).

In HiA i've only (re-) found something like 'Hibernate can make some performance optimazions for immutable types...'.

I have a brief understanding what 'mutable' means in that case ... but it would be great if someone could write 1 or 2 sentences about it ... or say 'rtfm at page xyz' ...

When do i use 'mutable=true' and when 'mutable=false' in a UserType?

thx!
curio


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 16, 2004 10:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Mutable means that a objects "inner things" can change without the object reference itself changing. For example a String object is immutable:

String s = "Test"
s1 = s.substring(3)
s1 =! s

e.g. the object "value" can never change as long as it is the same object. A Date however is mutable:

Date d = new Date(13,3,1998)
d.setYear(1997)

The d-reference is still the same, even though the object has now a different "value".


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 16, 2004 10:39 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
big thanks michael!

i don't know how to say that in english ... but i was completly ''standing on the line'' ... thanks for pushing :)

gtx
curio


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.