-->
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.  [ 2 posts ] 
Author Message
 Post subject: Replacing null values of MYsql
PostPosted: Mon Dec 21, 2009 8:22 am 
Newbie

Joined: Mon Dec 21, 2009 8:12 am
Posts: 3
Hi Guys,

I am new to hibernate.
I have a query which goes like this

<![CDATA[select _usermaster.mobileNo,_usermaster.emailid, _usermaster.gender,_usermaster.location,_usermaster.profession,mobile_access.accessDesc,age_range.range from UserMaster _usermaster left outer join _usermaster.accessMasterByMobileAccessId mobile_access left outer join _usermaster.agegroupMaster age_range where _usermaster.userId = :userId ]]>

now _usermaster.emailid can be null in database.

All i want is if its null then i want it to return varchar type ''

How can we do it ?

Above query gives me the error

Any help will be highly appreciated.


Top
 Profile  
 
 Post subject: Re: Replacing null values of MYsql
PostPosted: Mon Dec 21, 2009 10:34 am 
Beginner
Beginner

Joined: Tue Nov 03, 2009 9:38 am
Posts: 24
Why do you want to have '' instead of null for the email address? With null you could easily tell that the email is not set explicitly to ''.

Nevertheless, I'm not sure of how you would convert that on load, but maybe you could use a Hibernate interceptor to convert a null email to '' if you encounter a UserMaster(?) entity.


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