#151 Map back properties to POJO Deep Mapping

Dozer v.4.3
closed-fixed
None
5
2008-10-19
2008-09-28
No

I have found a bug where Map backed properties (Source)are not being copied to nested level (Deep Mapping)Properties of POJO Bean (Destination). The following mapping & class structure I am using:

<mapping map-id="TM1" type="one-way">
<class-a>java.util.Map</class-a>
<class-b>com.test.TestObject</class-b>
<field>
<a key="data1">this</a>
<b>name1.firstname</b>
<a-hint>java.lang.String</a-hint>
</field>
</mapping>

public class TestObject {

private Name name1 = null;
public Name getName1() {return name1;}
public void setName1(Name name1) {
this.name1 = name1;
}
}

public class Name {
private String firstname= null;
public String getFirstName() {
return firstname;
}
public void setFirstName(String str) {
this.firstname= str;
}
}

Thanks & Regards,
-Subhasis Sanyal

Discussion

  • dmitry (lv)

    dmitry (lv) - 2008-10-16
    • assigned_to: nobody --> buzdin
     
  • dmitry (lv)

    dmitry (lv) - 2008-10-18

    Using wildcard="false" option for such mapping is a current known workaround.

     
  • dmitry (lv)

    dmitry (lv) - 2008-10-19

    Reimplemented and fixed. Should work now. Will be included in next release.

     
  • dmitry (lv)

    dmitry (lv) - 2008-10-19
    • milestone: --> Dozer v.4.3
    • status: open --> closed-fixed
     
  • Subhasis Sanyal

    Subhasis Sanyal - 2008-10-22

    May I get a Patch or something workaround for this bug prior to next release? Also, when is the planned next released please?

     
  • dmitry (lv)

    dmitry (lv) - 2008-10-22

    Like I wrote in a previous comment workaround is to use wildcard="false" for the map-backed properties. In your case looks like the following:

    <mapping map-id="TM1" type="one-way" wildcard="false">
    <class-a>java.util.Map</class-a>
    <class-b>com.test.TestObject</class-b>
    <field>
    <a key="data1">this</a>
    <b>name1.firstname</b>
    <a-hint>java.lang.String</a-hint>
    </field>
    </mapping>

    Next release is planned in November.

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks