#337 Multiple superclass mappings, fields mapped over and over.

Dozer v5.3.3
closed-fixed
9
2011-10-09
2011-08-03
Anonymous
No

When classes being mapped have multiple super classes, super mappings are processed multiple times.

So if you have:

class TestClassA extends SuperClassA1{...}
class SuperClassA1 extends SuperClassA{...}
..and..
class TestClassB extends SuperClassB1{...}
class SuperClassB1 extends SuperClassB{...}

and mappings like so:
<mapping>
<class-a>TestClassA</class-a>
<class-b>TestClassB</class-b>
</mapping>

<mapping>
<class-a>SuperClassA</class-a>
<class-b>SuperClassB</class-b>
</mapping>
<mapping>
<class-a>SuperClassA1</class-a>
<class-b>SuperClassB1</class-b>
</mapping>

and do:
TestClassA a = new TestClassA();
dozerBeanMapper.map(a,TestClassB.class);

The fields defined in SuperClassA will be mapped twice. This is especially apparent in collection cases as the final mapped class will have the amount of collection items doubled.

Failing test and all test classes are in the attached ZIP file.
Failing unit test and all test classes are attached in the zip.

Discussion

  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2011-08-03

    A Quick failing unit test with the associated test classes

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2011-08-03
    • priority: 5 --> 9
     
    Last edit: Anonymous 2014-04-29
  • dmitry (lv)

    dmitry (lv) - 2011-10-09

    fixed in trunk

     
  • dmitry (lv)

    dmitry (lv) - 2011-10-09
    • milestone: 1331587 --> Dozer v5.3.3
    • assigned_to: nobody --> buzdin
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks