-->
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: Change DB values for hibernate select
PostPosted: Tue Jul 20, 2010 11:30 pm 
Newbie

Joined: Wed Jun 30, 2010 2:02 am
Posts: 1
Hello everyone!

The company I work for is using an old stupid ERP system, which treats the db column value of '8000000000000000' as null-> that's what it needs (dumb isn't it?). I somehow need to set up hibernate to treat this value as null. So, I wish hibernate to behave like this "If I see a column value of '8000000000000000' I consider the field to be of value 'null', everything else is considered to be an actual value".

Please help me out on this. I am not sure what should I do in this situation. Should I write the trigger or this can be done in some hibernate class? Is there a way to set up hibernate to treat values it gets the way I need it?

Best regards!


Top
 Profile  
 
 Post subject: Re: Change DB values for hibernate select
PostPosted: Wed Jul 28, 2010 2:05 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
You can implement your own value type:

http://nhforge.org/doc/nh/en/index.html#mapping-types-custom

It's pretty staight forward. Have a look at some custom types in the nhibernate sourcecode. Or search that forum for IUserType.

Here's also an example:

http://nhforge.org/blogs/nhibernate/archive/2009/10/15/mapping-different-types-iusertype.aspx

_________________
--Wolfgang


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.