-->
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: Store Hashmap with null values
PostPosted: Tue Jun 14, 2005 4:07 am 
Newbie

Joined: Thu Apr 28, 2005 2:18 pm
Posts: 4
Hi

I want to persist a Hashmap. Key and value types are both strings.
This is a basic task for Hibernate and well documented.
The problem comes when the map contains null values. Hibernate will not save key/value pairs when the value is null (key is not null).
When the value is not null it is saved. When I change the value to null and want to save it again, it is deleted. When I insert a record with a null value manually Hibernate will read it with no problem. So reading is ok.

My question: How can I tell Hibernate to save null string values from a Hashmap.

Many thanks for your help

Bruno


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 14, 2005 8:03 pm 
Beginner
Beginner

Joined: Mon Jun 13, 2005 5:52 pm
Posts: 43
Try putting an empty string into the map as the value, rather than null. That works, IIRC.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 14, 2005 11:55 pm 
Beginner
Beginner

Joined: Mon Jun 13, 2005 5:52 pm
Posts: 43
BTW: You might also try creatinig a UserType, as mentioned here:

http://forum.hibernate.org/viewtopic.php?t=943768


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.