#42 Mapping deep level field in Indexed structure

closed
None
5
2007-07-15
2006-04-20
No

Hi Folks,
Is it possible to map a deep level field inside a
indexed element ?
Example:

Class PersonalDetails {
String firstName;
String lastName;
Integer salary;
// getter-setters
}

// SOURCE CLASS
Class Family {
List familyMembers;
// getter-setter
// Some business logic that makes sure that the family
members collection is filled with PersonDetails objects.
public someBusinessLogic(){
familyMembers = new ArrayList();
PersonalDetails firstMember = new PersonDetails();
PersonalDetails secondMember = new PersonDetails();

familyMembers.add(firstMember);
familyMembers.add(secondMember);
}
}

NOTE: Family class has a COLLECTION of PersonalDetails

// DESTINATION CLASS
Class HeadOfHouseHold{
String name;
Integer sal;
// Other fields like address etc, credit score etc
//getter-setters
}

For the above classes if I have to copy source class
contents (Family) details into destination class
(HeadOfHouseHold). Family class stores the family
member details in an array list. And I ALWAYS KNOW that
the first entry in the array list is the actual head of
household.

Is it possible to map

<class-a>Family</class-a>
<class-b>HeadOfHouseHold</class-b>
<field>
<a>familyMembers[0].firstName</a>
<b>name</b>
</field>
<field>
<a>familyMembers[0].salary</a>
<b>sal</b>
</field>

I know that indexed mapping was added recently, but I
am not sure if indexed mapping and deep level mapping
(particularly when the map is a collection) is supported.

Thanks,
Sachin

Discussion

  • Matt Tierney

    Matt Tierney - 2006-10-02

    Logged In: YES
    user_id=1236069

    I believe this is resolved in the 2.4 code base but I
    could be wrong. Please take a look at the
    IndexMappingTest and check to see if this use case is
    accounted for

     
  • Matt Tierney

    Matt Tierney - 2006-10-02
    • status: open --> pending
     
  • Matt Tierney

    Matt Tierney - 2006-10-14
    • assigned_to: nobody --> mhtierney
     
  • Matt Tierney

    Matt Tierney - 2006-10-14

    Logged In: YES
    user_id=1236069

    assigment

     
  • Matt Tierney

    Matt Tierney - 2006-10-16
    • status: pending --> closed
     
  • wing tung Leung

    wing tung Leung - 2007-01-10

    Logged In: YES
    user_id=239724
    Originator: NO

    IndexMappingTest in the 2.4 release does not contain such a test scenario. I haven't had the time yet to add it myself .. I also tried using the combination of deep level mapping behind an indexed collection, and it does not work.

     
  • Alex Eagle

    Alex Eagle - 2007-04-10

    Logged In: YES
    user_id=1440672
    Originator: NO

    I need this feature pretty badly - I am thinking about contributing it. Could this feature request be re-opened?? Or is there a duplicate somewhere else?

     
  • Matt Tierney

    Matt Tierney - 2007-05-29
    • status: closed --> open
     
  • Anonymous - 2007-05-29

    Logged In: YES
    user_id=1803910
    Originator: NO

    I also have a need for this feature. Here is just a little background...I'm compiling an external vendor's XML Schema with XMLBeans and using Dozer to map the XMLBean to our internal POJOs. The vendor schema's are pretty massive and deep and I would definitely need to be able to mix deep mappings along with indexes.

    Here is my initial thread
    https://sourceforge.net/forum/forum.php?thread_id=1744439&forum_id=452530

    If there is a fix in the code base, does anyone have an estimate on the next stable release?

    Thanks!

     
  • Matt Tierney

    Matt Tierney - 2007-05-29
    • assigned_to: mhtierney --> nobody
     
  • Matt Tierney

    Matt Tierney - 2007-07-15

    Logged In: YES
    user_id=1236069
    Originator: NO

    This has finally been implemented. The 4.0 refactoring allowed this feature to be added without too much trouble. For deep index mapping, hints do not need to be supplied if the collection field(s) use jdk1.5 generics or they are arrays. Otherwise, you need to specify hint(s) for the nested indexes in the deep mapping

     
  • Matt Tierney

    Matt Tierney - 2007-07-15
    • assigned_to: nobody --> mhtierney
    • status: open --> pending
     
  • Matt Tierney

    Matt Tierney - 2007-07-15
    • 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