Title: Xml attribute-element

I'm having problem marshalling, and not sure why.  I know that java primitives default to "attribute", but it appears that you can override that behaviour by explicitly specifying them (correct?).  I have the following mapping:

  <class name="com.intrinity.instore.castor.UserImpl" identity="id" key-generator="SEQUENCE">
    <description>User</description>
    <cache-type type="none" />
    <map-to table="users" xml="user" />
    <field name="id" type="integer">
      <sql name="id" type="integer" />
      <xml name="id" node="attribute" />
    </field>
    <field name="name" type="string">
      <sql name="name" type="varchar" dirty="ignore" />
      <xml name="name" node="text" />
    </field>
    <field name="password" type="string">
      <sql name="password" type="varchar" dirty="ignore" />
      <xml name="password" node="element" />
    </field>
    <field name="isGroup" type="boolean">
      <sql name="isgroup" type="bit" dirty="ignore" />
      <xml name="is_group" node="element" />
    </field>     
    <field name="isActive" type="boolean">
      <sql name="active" type="bit" dirty="ignore" />
      <xml name="is_active" node="element" />
    </field>
    <field name="createdBy" type="integer">
      <sql name="createdby" type="integer" dirty="ignore" />
      <xml name="created_by" node="element" />
    </field>
    <field name="created" type="date">
      <sql name="created" type="timestamp" dirty="ignore" />
      <xml name="created" node="element" />
    </field>
    <field name="updatedBy" type="integer">
      <sql name="updatedby" type="integer" dirty="ignore" />
      <xml name="updated_by" node="element" />
    </field>
    <field name="updated" type="date">
      <sql name="updated" type="timestamp" dirty="check" />
      <xml name="updated" node="element" />
    </field>
  </class>

and it generates the following xml:

        <user-impl id="8" is-active="true" created-by="2" updated-by="8" is-group="false">
                <created>2001-09-13T12:01:23.000</created>
                <updated>2001-10-14T12:04:55.000</updated>
                <name>Bob</name>
                <password>bob</password>
        </user-impl>

To be very specific, is-active, created-by, updated-by and is-group should be elements (id is correct, I wanted attribute).  Also, I wanted name to be a text element inside <user-impl> (I believe it is possible to have text at same level as element, correct?).

Thanks to whoever can assist,
Trevor D. Cook

Reply via email to