Stephen, Michael, Why don't we add a 'nillable' attribute to the mapping file ?
Werner > -----Original Message----- > From: Stephen Bash [mailto:[EMAIL PROTECTED] > Sent: Dienstag, 21. März 2006 21:12 > To: [email protected] > Subject: Re: [castor-user] Castor defaults numeric java objects to 0 > > Michael- > > So I remembered this discussion a while back and dug through > the archives to find it. > > http://marc.theaimsgroup.com/?l=castor-user&m=112267315616893&w=2 > > If you're using a schema and source generation, then possibly > using nillable in the schema will help. > > Just went digging through the code, and while there doesn't > seem to be a way to access nillable from the mapping file, > you can set nillable if you get your hands on the > XMLFieldDescriptorImpl. I could see an implementation > (albeit non-optimal) where a mapping file is loaded, and then > the the necessary ClassDescriptors are retrieved in order to > get the XMLFieldDescriptor objects and set nillable to true. > > Sorry I can't be of much more help. > > Stephen > > > On 3/21/06, Michael Heath <[EMAIL PROTECTED]> wrote: > > True objects, Floats, Integers, etc. > > > > > > >From: "Stephen Bash" <[EMAIL PROTECTED]> > > >Reply-To: [email protected] > > >To: [email protected] > > >Subject: Re: [castor-user] Castor defaults numeric java > objects to 0 > > >Date: Tue, 21 Mar 2006 14:18:36 -0500 > > > > > >Michael- > > > > > >What types of objects are we referring to? Primitives, primitive > > >wrappers or true objects? > > > > > >Thanks, > > >Stephen > > > > > > > > >On 3/21/06, Michael Heath <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > > > > > I have XML I am unmarhsalling and when the field is > empty I want > > > > to have > > >the > > > > java object set to null. > > > > > > > > The default behaviour appears to be setting the java > object to a 0 > > > > value...this is of course a big problem if the value is > supposed > > > > to be > > >empty > > > > and not 0. > > > > > > > > Can anyone advise? I wrote a custom field handler but > this seems > > > > to be called after the object is created and set to 0. > > > > > > > > thanks > > > > M > > > > > > > > > > > > > > > > ------------------------------------------------- > > > > If you wish to unsubscribe from this list, please send an empty > > > > message to the following address: > > > > > > > > [EMAIL PROTECTED] > > > > ------------------------------------------------- > > > > > > > > > > > > > > > > ------------------------------------------------- > > If you wish to unsubscribe from this list, please send an empty > > message to the following address: > > > > [EMAIL PROTECTED] > > ------------------------------------------------- > > > > > ------------------------------------------------- If you wish to unsubscribe from this list, please send an empty message to the following address: [EMAIL PROTECTED] -------------------------------------------------

