Even though you say that the "test" property is nillable in the XSD, the
behavior you're describing really sounds like it is not. Are you sure the
XSD is valid and the element is nillable? The element should look something
like this:

      <xsd:element name="test" type="..." nillable="true"/>

If you're getting down to the Accessor.create() code, it implies that there
is no property named "test" in the type, which seems to imply that there's
something wrong with your metadata.

Frank

Jawad - CitizenPlace <[email protected]> wrote on 09/08/2010 01:05:16
PM:

> [image removed]
>
> Tuscany SDO and xsi:nil
>
> Jawad - CitizenPlace
>
> to:
>
> user
>
> 09/08/2010 01:06 PM
>
> Please respond to user
>
> Hi everyone.
>
> I'm having a hard time trying to add xsi:nil=true to some properties
> in the generated instances.
>
> I have read that doing that was as simple as setting the property to
null.
> Let's consider that I have a DataObjectBase object called
> "builtObject". My property is called "test" and is set to nillable in my
XSD.
>
> If I write builtObject.set("test", null), the property is not set as
> expected : if I then call builtObject.isSet("test"), I get 'false'
> where as I should get true as stated in the specification (test=null
> + isSet(test) = true ==> xsi:nil). Logically, the returned XML
> simply ignores the property while I need it to be present and set to
null.
>
> I jumped into the source code of SDO and I got to these lines:
>  public static void set(DataObject dataObject, String path, Object value)
>  {
> Property property = dataObject.getType().getProperty(path);
>     if (property != null)
>         {
>             dataObject.set(property, value);
>          }
>     else
>          {
>             Accessor.create((EObject)dataObject, path,
> value).setAndRecyle(value);
>     }
> }
>
> I do not really understand what is the Accessor used for.

> --
> Jawad, pour l?équipe CitizenPlace
> Tél : +33 9 52 31 26 45
> Mobile : +33 6 20 08 16 13
> E-mail : [email protected]

Reply via email to