#287 one-way doesn't work at the mapping level

Dozer v5.3.2
closed-invalid
5
2011-01-01
2010-10-28
No

One way mapping doesn't work when used at the mapping level:

<mapping type="one-way">
<class-a>A</class-a>
<class-b>APrime</class-b>
</mapping>

When mapping APrime to A, the fields in APrime are still copied to A!

Discussion

  • dmitry (lv)

    dmitry (lv) - 2010-10-29

    Could you try to add empty mapping from APrime to A with wildcard=false specified. I have a feeling that even if you choose one-way, but you are having wildcard option, then it is one-way only for explicit mappings, not implicit.

     
  • Christian Bourque

    I tried the following and it didn't work:

    <mapping type="one-way" wildcard="false">
    <class-a>com.mycompany.mavenproject1.A</class-a>
    <class-b>com.mycompany.mavenproject1.APrime</class-b>
    </mapping>

     
  • dmitry (lv)

    dmitry (lv) - 2010-12-31

    Hi, you should also set wildcard=false.
    Dozer works in implicit and explicit mapping modes. You are telling in your mapping that you want explicit one-way and implicit other way around. What you need in addition is to disable implicit mappings via wildcard attribute

     
  • dmitry (lv)

    dmitry (lv) - 2010-12-31
    • assigned_to: nobody --> buzdin
    • status: open --> pending-invalid
     
  • Christian Bourque

    Didn't you read my previous comment? I have already tried that!

     
  • Christian Bourque

    • status: pending-invalid --> open-invalid
     
  • dmitry (lv)

    dmitry (lv) - 2011-01-01

    sorry for the deja-vu effect :)

    Missed your and mine comments altogether.

    Having looked at the test you sent came to conclusion that this is still not a bug.

    One important point is wildcard setting in configuration block. In your case it is "true". To make test pass you should add one more reverse one-way mapping with wildcard=false.

    Another option is to set configuration level wildcard to false and then Dozer will not try to perform mappings automatically, but only via explicit field mappings.

    <mapping wildcard=false type=one-way>
    <a>APrime</a>
    <b>A</b>
    </maping>

    I am closing the issue ticket.

     
  • dmitry (lv)

    dmitry (lv) - 2011-01-01
    • milestone: 1163967 --> Dozer v5.3.2
    • status: open-invalid --> closed-invalid
     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks