Menu

context mapping- No ClassMap found for mapId

Help
Yariva
2007-06-10
2013-05-02
  • Yariva

    Yariva - 2007-06-10

    Hi
    I have a problem with context mapping -
    the XML file have the following mappings:

    <mapping map-id="requestMessage">
        <class-a>newAPI.Question</class-a>
        <class-b>oldAPI.QuestionStruct</class-b>
        <field>
            <a>questionId</a>
            <b>Question_id</b>
        </field>
        <field>
            <a>questionText</a>
            <b>Question_text</b>
        </field>
        <field> <!-- this is a diffrent map -->
            <a>userAnswer</a>
            <b>answer_text</b>
        </field>   
    </mapping>

    <mapping map-id="responseMessage">
        <class-a>newAPI.Question</class-a>
        <class-b>oldAPI.QuestionStruct</class-b>
        <field>
            <a>questionId</a>
            <b>Question_id</b>
        </field>
        <field>
            <a>questionText</a>
            <b>Question_text</b>
        </field>           
        <field> <!-- -->
            <a>actualAnswer</a>
            <b>answer_text</b>
        </field>   
    </mapping>
       
    and the code that i run for the mapping is:
    mapper.map(oldObject, (NewResponse)newObject, "responseMessage");

    the mapping does not work, and i get this WARN in the log:
    17:00:37,065  WARN ClassMapFinder:68 - No ClassMap found for mapId:responseMessage

    what could be the reason for that?

    BTW, I've also tried to do a field level mapping, but it didn't worked as well.

    Any Help?

    10x
    Yariv,

     
    • Yariva

      Yariva - 2007-06-11

      Sorry, the above example does work! - i had a problem with Tomcat.

      On the other-hand, the field's context mapping does not work.
      below is the XML I'm using (I think it's better then having 2 mappings for the same classes). in this example I'm using map-id on the field level. but dozer does not find the map -
      09:35:01,645  WARN ClassMapFinder:68 - No ClassMap found for mapId:responseMessage

      <mapping>
        <class-a>newAPI.Question</class-a>
        <class-b>oldAPI.QuestionStruct</class-b>
          <field>
            <a>questionId</a>
            <b>Question_id</b>
         </field>
         <field>
           <a>questionText</a>
           <b>Question_text</b>
         </field> 

         <field map-id="requestMessage">
           <a>userAnswer</a>
           <b>answer_text</b>
         </field>
        
         <field map-id="responseMessage">
           <a>actualAnswer</a>
           <b>answer_text</b>
         </field> 
      </mapping>

      any idea?

      10x
      Yariv.

       
    • Matt Tierney

      Matt Tierney - 2007-07-09

      Can you submit a simple unit test that reproduces the field context mapping issue you are seeing?  We do have existing unit tests for field context mapping that run green, so I am not sure what the difference is with your use case

       

Log in to post a comment.

MongoDB Logo MongoDB