Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » @Embedded objects in NoSQL/Mongo are persisted inside array containers
@Embedded objects in NoSQL/Mongo are persisted inside array containers [message #1122454] Tue, 01 October 2013 15:41 Go to next message
Jay Roberts is currently offline Jay RobertsFriend
Messages: 2
Registered: April 2013
Junior Member
We are getting a result (this is conceptual code):

@Embeddable
class Address{
String street;
}

@Entity
class Person{

@Field
String name;

@Field
@Embedded
Address address
}

When we persist a Person, the Mongo object/JSON has the embedded Person wrapped in an Array, a Person instance in Mongo looks like

{
"name" : "John",
"address": [{"street": "Elm Street"}]
}

We don't want this extraneous array, any way to prevent this? We need it gone for backwards data compatibility. I.e, we want it to look like:

{
"name" : "John",
"address": {"street": "Elm Street"}
}

Thanks to anyone who has any advice on this!

Jay Roberts


[Updated on: Wed, 02 October 2013 12:31]

Report message to a moderator

Re: @Embedded objects in NoSQL/Mongo are persisted inside array containers [message #1124391 is a reply to message #1122454] Thu, 03 October 2013 13:39 Go to previous messageGo to next message
Shaun Smith is currently offline Shaun SmithFriend
Messages: 197
Registered: July 2009
Senior Member
If you remove the @Field from Person.address does this solve the problem?

--Shaun
Re: @Embedded objects in NoSQL/Mongo are persisted inside array containers [message #1168462 is a reply to message #1124391] Sun, 03 November 2013 10:04 Go to previous message
Thorsten  Möller is currently offline Thorsten MöllerFriend
Messages: 25
Registered: July 2009
Junior Member
Same behavior for us. Even if there is no @Field annotation present then the we see the extraneous array in the DB for embedded objects.
Previous Topic:How to configure eclipselink.connection-pool.sequence
Next Topic:v.2.6.0 and JGroups
Goto Forum:
  


Current Time: Tue Apr 23 14:23:23 GMT 2024

Powered by FUDForum. Page generated in 0.03024 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top