Unowned relationships on unsaved data objects.

25 views
Skip to first unread message

MagusDrk

unread,
Dec 15, 2011, 11:51:00 AM12/15/11
to Google Web Toolkit
Hi All.

Mi name in Miguel and I'm getting a kind of trouble about modeling
data objects to the google data store. Right now I have a data model
to be saved in the datastore, I need cover next requirements, but I
really don't know to to handle this.

I have a data model wich entities have other entities as children and
those children has references to their "brothers" (different kind of
childrens owned by the same parent). In the data model, the parent-
child relationship is modeled by an owned relationship (see link
bellow) and the child-child is an unowned relationship. (referencing
the Key id of the brother). to this point there is no problem (at
least that's what I think) but my problem comes when I try to
reference two children each other before have being saved in the
datastore.

http://code.google.com/intl/es-ES/appengine/docs/java/datastore/jdo/relationships.html#Owned_One_to_Many_Relationships

I mean, I can create a parent (with id null), some children (each one
with id null), untill here, there is no problem because each parent
knows its children though their ids are null, but here (before sending
it to data store) I have to reference a child from another one
(somethig as child.setBigBrother(anotherChild.getId()), but in this
case, the "anotherChild.getId()" is a null value.

Actually I'have tried to popullate my ids before sending them to the
datastore (creating with KeyFactory a key based on parent's key) and
it works like good, but, in some cases, I need to create children
without parent to be added later to the parent (wich is imposible
because the child's key creation needs the parent)

I'm really consufed on how to solve this. I hope being clear enough,
but if you are confused too, please, tell me and I'll try to make it
more clear.

Thanks a lot!

MagusDrk

unread,
Dec 20, 2011, 8:52:31 AM12/20/11
to Google Web Toolkit
Hi, additionally, I need to use and reference unsaved objects by id,
but before being saved, they have null Id, how can I handle it? Help,
please.

Ed

unread,
Dec 20, 2011, 10:18:05 AM12/20/11
to google-we...@googlegroups.com
Which widgets are you using ?

MagusDrk

unread,
Dec 20, 2011, 5:34:03 PM12/20/11
to Google Web Toolkit
Sorry, I don't understand widgets, I'm refering to Data (DAO) classes
and JDO persistence.

Ed Bras

unread,
Dec 20, 2011, 5:35:42 PM12/20/11
to google-we...@googlegroups.com
> Sorry, I don't understand widgets,
Exactly my point...
I think you posted your message in the wrong forum.


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Reply all
Reply to author
Forward
0 new messages