Main Overview Wiki Issues Forum Build Fisheye

Welcome, Guest
Guest Settings

Compass Support Forums » Compass » Compass Users

Thread: Multiple Mappings for Property

This question is answered. Helpful answers available: 1. Correct answers available: 1.

Permlink Replies: 1 - Pages: 1 - Last Post: May 16, 2007 1:51 PM Last Post By: Shay Banon

Posts: 34
Registered: 5/16/07
Multiple Mappings for Property
Posted: May 16, 2007 3:48 AM
  Click to reply to this thread Reply

I have a property that I want to map in two ways. First I want it mapped as a reference, and second as a meta-data property. Of course this won't work as mappings must have a unique name within a class mapping. Is there a way to work around this?

See for example this mapping:
<compass-core-mapping package="nl.wis.test">
    <class name="ObjectB" alias="object-b">
        <id name="id" />
        <property name="parent" managed-id="false">
            <meta-data converter="path-converter" index="un_tokenized">path</meta-data>
        <reference name="parent" />
        <property name="name">
Shay Banon

Posts: 4,028
Registered: 9/6/05
Re: Multiple Mappings for Property
Posted: May 16, 2007 1:51 PM   in response to: NetForce1 in response to: NetForce1
  Click to reply to this thread Reply
Except that obvious answer of adding another getter (just getter no need for setter) which will be mapped with the property mapping you can try and use dynamic meta-data support.
Guru: 2001 + pts
Expert: 501 - 2000 pts
Super-star: 101 - 500 pts
Assistant: 51 - 100 pts
Participant: 0 - 50 pts
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums