Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML configuration for extended classes #17

Closed
CasperDB opened this issue Aug 19, 2015 · 8 comments
Closed

XML configuration for extended classes #17

CasperDB opened this issue Aug 19, 2015 · 8 comments

Comments

@CasperDB
Copy link

I'm trying to map between two classes, however the desired destination class need to extend another class. Is this possible?

I've asked this question in more detail, here:

Thanks,
Casper

@avurro
Copy link
Member

avurro commented Aug 19, 2015

the class Language is the same in both classes? or they are two classes with the same name but different packages?

@CasperDB
Copy link
Author

They are two different classes, same name and different packages yes.

@avurro
Copy link
Member

avurro commented Aug 20, 2015

You need to map Language soo

@CasperDB
Copy link
Author

I'm not sure I follow, any chance you could show me what the implementation and config file would look like for the language field only?

@avurro
Copy link
Member

avurro commented Aug 20, 2015

<jmapper>
    <class name="package.RequestS">
        <attribute name="language">
            <value name="language"/>
        </attribute>
    </class>
    <class name="package.Language">
        <global />
    </class>
</jmapper>

I hope this is helpful

@CasperDB
Copy link
Author

Unfortunately that didn't work. I still get the same error:
"Caused by: com.googlecode.jmapper.exceptions.UndefinedMappingException: it was not possible to map the mapped language field of the RequestD Class with the language field of RequestS Class,.."

It seems like I'm missing something to extend the Destination class (RequestD) to RequestBase where the variables are declared.

@avurro
Copy link
Member

avurro commented Aug 20, 2015

try to add the configuration to RequestD as follow:

<jmapper>
    <class name="package.RequestD">
        <attribute name="language">
            <value name="language"/>
        </attribute>
    </class>
    <class name="package.Language">
        <global />
    </class>
</jmapper>

Meanwhile i will investigate on this issue

@CasperDB
Copy link
Author

I think the answer is to globally map to the destination class, this has worked for me:

<jmapper>
    <class name="package.RequestD">
        <global/>
    </class>
</jmapper>

Thank you for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants