We're updating the issue view to help you get more done. 

Embeddable object with an ElementCollection that contains Embeddable objects

Description

I have the following objects

1 2 3 4 5 6 @Entity(name = "someClass") public class SomeClass() { @Embedded private EmbeddedObject embeddedObject; }
1 2 3 4 5 6 @Embeddable public class EmbeddedObject () { @ElementCollection private List<ListElement> listElements; }
1 2 3 4 5 6 7 @Embeddable public class ListElement() { private String name; private String value; }

I was expecting the Mongo object would look like this:

1 2 3 4 5 6 7 8 9 10 11 { "embeddedObject": { "listElements": [ { "name": "someName", "value": "someValue" } ] } }

Instead it looks like this (which is not desired):

1 2 3 4 5 6 7 8 9 10 11 12 13 { "embeddedObject": { "listElements": [ { "listElements": { "name": "someName", "value": "someValue" } } ] } }

I can achieve the desired situation as follows:

1 2 3 4 5 6 @Entity(name = "someClass") public class SomeClass() { @ElementCollection private List<ListElement> listElements; }

However, this is not the way I want to store the objects.

Environment

Hibernate HQL: 1.2.0.Final
Hibernate OGM: 5.0.0.Final
Hibernate OGM MongoDB: 5.0.0.Final
MongoDB Java Driver: 3.4.1

Status

Assignee

Unassigned

Reporter

MartijnP

Labels

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Affects versions

5.0.4.Final

Priority

Minor