#109 Map-backed mapping with map-id

closed
None
5
2007-12-16
2007-09-17
Dan Cruz
No

I've recently updated from Dozer 2.4 to 4.0. I have a one-way mapping from a java.util.Map to a JavaBean with a map-id defined that no longer works without modification. I've traced the issue to the ClassMapFinder.findInterfaceMappings() use of ClassMapKeyFactory.createKey(Class, Class) without specifying the mapId.

As an example, using the following mapping:

<mappings>
<mapping map-id="testMap" map-null="false" type="one-way">
<class-a>java.util.Map</class-a>
<class-b>TestBean</class-b>
<field>
<a key="aStringValue">this</a>
<b>stringValue</b>
</field>
</mapping>
</mappings>

where class A is a java.util.Hashtable and TestBean is a simple JavaBean with a single stringValue property, and MapperIF.map(testHashTable, TestBean.class, "testMap") is called, the mapping will not occur since the cache key used to find the ClassMap is "SOURCE CLASS-->java.util.Map DEST CLASS-->TestBean", which differs from the existing cache key of "SOURCE CLASS-->java.util.Map DEST CLASS-->TestBean MAP ID-->testMap". If you change the class-a element to java.util.Hashtable, the mapping will occur.

Discussion

  • Matt Tierney

    Matt Tierney - 2007-12-16

    Logged In: YES
    user_id=1236069
    Originator: NO

    I create a unit test for this use case in the 4.2 code base and it ran green. I don't see any noticeable differences, so this may have been indirectly resolved by another fix. I checked in the unit test --> MapTypeTest.testMapToVoUsingMapInterface()

     
  • Matt Tierney

    Matt Tierney - 2007-12-16
    • assigned_to: nobody --> mhtierney
    • status: open --> pending
     
  • Matt Tierney

    Matt Tierney - 2007-12-16
    • status: pending --> closed
     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks