It's possible to orphan a child object, but only if you delete the parent
entity. The reason is that the parent path information is stored in the key
of the child object:
http://code.google.com/appengine/docs/java/datastore/queriesandindexes.html

On Sun, Nov 15, 2009 at 9:28 PM, ascetik <asce...@gmail.com> wrote:

> Is is possible to update a child object directly(never calling the
> parent) and still reliably keep the 'owned one to many' relationship?
> I have been doing this on one of my apps and then noticed that the
> children will sometimes become orphaned from the parent. I'm trying to
> track down the problem but it occurred to me that this may be messing
> up the index or something strange like that.
>
> Does this make sense or should i elaborate more?
>
> the structure is similar to:
>
> public class UserObj {
>         @PrimaryKey
>         @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>         private Long id;
>        @Persistent
>        private List<VehicleObj> Vehicles;
>        public Long getId() {
>                return id;
>        }
>        public void setId(Long id) {
>                this.id = id;
>        }
>        public List<VehicleObj> getVehicles() {
>                return Vehicles;
>        }
>        public void setVehicles(List<VehicleObj> vehicles) {
>                Vehicles = vehicles;
>        }
>
> }
>
>
> ....
> later on I update one of the VehicleObj's based on a search without
> ever instantiating the parent UserObj and every so often i loose a
> vehicle that should be attached to the UserObj. It's still in the
> datastore just orphaned.
>
> This may not be the problem but i thought it was a good place to start
> tracking it down.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=.
>
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=.


Reply via email to