[hibernate-dev] [OGM] Element collections stored embedded in entity
Emmanuel Bernard
emmanuel at hibernate.org
Wed Mar 12 09:48:51 EDT 2014
There are two problems,
I am not sure why it uses "nicknames" as the property name, I don't
think that's the actual default value in JPA, is it?
Otherwise, I agree with you, we could simplify it except when the
collection is keyed or indexed. At this stage you need to store the key
or the index next to the value.
About collection&&element, the bug is already opened
https://hibernate.atlassian.net/browse/OGM-251
Hasn't been addressed yet :(
Emmanuel
On 12 Mar 2014, at 10:21, Gunnar Morling wrote:
> Hi,
>
> I just did some testing around @ElementCollection using MongoDB. A
> collection of a basic type results in the following persistent format
> of
> the embedding entity:
>
> {
> "_id": "17457a47-abfc-4fb7-955e-17acb0b49808",
> "nicknames": [
> { "nicknames": "idrA" },
> { "nicknames": "day[9]" }
> ]
> }
>
> Is there any reason why we don't use this instead:
>
> {
> "_id": "17457a47-abfc-4fb7-955e-17acb0b49808",
> "nicknames": [
> "idrA",
> "day[9]"
> ]
> }
>
> For non-basic, embeddable types it looks like this:
>
> {
> "_id": "17457a47-abfc-4fb7-955e-17acb0b49808",
> "homeAddress": [
> {
> "homeAddress.collection&&element.city": "Paris",
> "homeAddress.collection&&element.country": "France",
> "homeAddress.collection&&element.street1": "1 avenue des
> Champs Elysees",
> "homeAddress.collection&&element.street2": null,
> "postal_code": "75007"
> }
> ]
> }
>
> Is this "collection&&element" style intended, or could we use the
> simple
> property name as keys here ("postal_code" is specified explicitly via
> @Column)?
>
> I can file issues in JIRA (and take a look at some point), but wanted
> to be
> sure I'm not missing something here.
>
> Thanks,
>
> --Gunnar
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
More information about the hibernate-dev
mailing list