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 11:41 Go to next message
Jay Roberts is currently offline Jay Roberts
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 08: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 09:39 Go to previous message
Shaun Smith is currently offline Shaun Smith
Messages: 191
Registered: July 2009
Senior Member
If you remove the @Field from Person.address does this solve the problem?

--Shaun
Previous Topic:Reverse Engineering Legacy Database
Next Topic:[SOLVED] Using Eclipselink in RCP environment? Want to use EclipseLink 2.5.1
Goto Forum:
  


Current Time: Mon Oct 07 16:32:40 EDT 2013

Powered by FUDForum. Page generated in 0.01501 seconds