Hi!

I run into a new problem. I want to use different "views" for
some entity, therefore I use abstract mappings; because some times I need
to marshall out only the entity without its details, and in some context
the details should be marshalled too. So I use a binding like this.:



  <mapping class="xmldemo.Partner"
abstract="true" type-name="partner-type">

    <value field="id" name="id"
ident="def" />

    <value filed="name" name="name"
/>

  </mapping>

  <mapping class="xmldemo.Partner"
name="partner">

    <structure map-as="partner-type"/>

    <collection name="leftRelations"
field="leftRelations"
item-type="xmldemo.PartnerRelation"
usage="optional"/>

    <collection name="rightRelations"
field="rightRelations"
item-type="xmldemo.PartnerRelation" usage="optional"
/>

  </mapping>

  <mapping class="xmldemo.PartnerRelation"
name="partner-relation">

    <value name="id"
field="id"/>

    <value name="relationType"
field="relationType" />

    <value field="leftPartner"
name="leftRelation" ident="ref" /> <!-- the type
of this field in java is: xmldemo.Partner -->

    <value field="rightPartner"
name="rightRelation" ident="ref" /> <!-- the
type of this field in java is: xmldemo.Partner -->

    <!-- if I marshall here by the "partner"
mapping, then it will be an infitinite loop, so I need only the abstract
"partner-type", but only the ident="ref" would
enough for me -->

    <!--structure field="leftPartner"
name="leftRelation" map-as="partner-type" /-->

  </mapping>

But this cause an error, because jibx don't find ID definition in the
"partner" mapping, which is the mapping for the java type. Is
there a 'map-as' like attribute for the 'value' tag?

What can I do with it? Should I write custom marshaller / unmarshaller?

      Cheers,

             
Zoltán



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to