Hello
 
I have a 1 to 0 or 1 relationship mapped as follow
 
      <result property="SubObject" column="sub_object_id"
select="SelectBySubtObjectId"/>
 
This works fine, but what we are trying to implement is the NullObject
pattern in which a null value is mapped to a specific null object
instead of null.
 
ie.  In Parent object, I have a reference called SubObject.  Ibatis
right now will set that reference to null when a database value of null
is encountered, what I want is for Ibatis to set that value to
SubObject.NULL instead.
 
Is this possible? What is the proper way of doing this?  
 
I have tried implementing ITypeHandlerCallback by doing the following
but doesn't work.  When is the NullValue getter called?
 
        public void SetParameter(IParameterSetter setter, object
parameter)
        {
        }
 
        public object GetResult(IResultGetter getter)
        {
            return getter.Value;
        }
 
        public object ValueOf(string s)
        {
            return s;
        }
 
        public object NullValue
        {
            get { return SubObject.NULL; }
        }
 
Thanks, 
Ka-Wai 

Reply via email to