2014-03-12 14:48 GMT+01:00 Emmanuel Bernard <emmanuel(a)hibernate.org>:
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?
Default value in which way?
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.
Yes, sure. This is about a simple non-ordered collection (a Set in this
case).
About collection&&element, the bug is already opened
https://hibernate.atlassian.net/browse/OGM-251
Hasn't been addressed yet :(
Ah, never noticed that one before. Just assigned it to me.
--Gunnar
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(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/hibernate-dev
>