-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Is it possible to map nested collections?
PostPosted: Thu Mar 03, 2016 1:41 am 
Newbie

Joined: Thu Mar 03, 2016 1:09 am
Posts: 1
I'm using MongoDB and have a collection called user_experiments.

Each element of user_experiments is like:

Code:
{
    _id: ObjectId("abc"),
    userId: "123"
    experiments: {
        "experiment1" : {"variantA" : "variantValue1",
                         "variantB", "VariantValue2"
                         "variantC", "VariantValue3"},

        "experiment2" : {"variantD", "VariantValue4"}
    }
}


The problem I'm having is mapping experiments.

Ideally in the my java class I would like to have a field like:

Code:
Map<String, Map<String, String>> experiments;


or

Code:
Map<String, ExperimentVariantMapping> experiments;


where ExperimentVariantMapping had a Map<String, String> inside of it.

But I've been unable to achieve this.

Seems like:
https://forum.hibernate.org/viewtopic.php?f=31&t=1039103
https://forum.hibernate.org/viewtopic.php?f=31&t=1038740

Discuss similar problems (my first try involved nested @ElementCollection annotations).

The one-to-many approach mentioned in the topics above seems to require an additional collection. This data already exists in a MongoDB in the above form so I really can't alter the DB structure. Is there a way I can map this as is in any form?


Top
 Profile  
 
 Post subject: Re: Is it possible to map nested collections?
PostPosted: Tue Mar 08, 2016 6:42 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
Hi,
I don't think this is possible at the moment with OGM. Sorry.

I've opened a JIRA to keep track of the issue: https://hibernate.atlassian.net/browse/OGM-987

Davide


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.