Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] [MOXy] overriding mapped xpaths

Hi Polly,

This is one that I have been thinking about for a while. This type of support is available in object-to-relational EclipseLink for AggregateObjectMapping. Could you enter an enhancement request for this one as well. One of our focus areas for EclipseLink 2.1 is community entered bugs, so I want to sure your enhancements are logged with a non-committer email address so that they are ranked accordingly.

As a work aroud you could use a converter strategy (similar to the one discussed below), or an XMLTransformationMapping.

Converter Example
http://forums.oracle.com/forums/message.jspa?messageID=3976208#3976208)

-Blaise

polly.c.chang wrote:
We have a situation like this:

<Foo>
... ...
    <C>...</C>
</Foo>

The domain model looks like:

public class MyBasicType {
    String fieldA;
    String fieldB;
}

public class Foo{
    MyBasicType myBasicType
    String fieldC;
}

Normally I'd map the xpaths for MyBasicType to elements "A" and "B" and map
Foo's reference to MyBasicType using an XMLCompositeCollectionMapping.  But
what happens if we want to reuse MyBasicType to map to this document:

<Bar>
    <Y>...</Y>
    <Z>...</Z>
    ...
</Bar>

public class Bar {
    MyBasicType myBasicType
    ...
}

This would require overriding the xpaths defined for MyBasicType's internal
fields based on where MyBascType is used (Foo or Bar).  This is not possible
is it?  What is your recommendation for mapping to this domain model?

Thanks!
--Polly


Back to the top