You're using an owned relationship, which means the parent's key is embedded
in the keys of all the children. Thus, all children must have a parent in
order to be persisted.
You can either make a dummy group as Ian suggested, or use an unowned
relationship and just store the key of the group with each child --
depending on the queries you need to make, this should be adequate. This
will also be necessary if students are able to switch groups eventually
since entity keys cannot be changed after they're persisted.

- Jason

On Wed, Sep 16, 2009 at 6:42 AM, Arash <aras...@gmail.com> wrote:

>
> I have a one-to-many relationship, mapped as:
>
> @PrimaryKey
>    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>    @Extension(vendorName="datanucleus", key="gae.encoded-pk",
> value="true")
>    private String key;
>
>    @Persistent
>    private String name;
>
>    @Persistent(nullValue= NullValue.NONE)
>    private Group parent;
>
> And in many side:
>  @Persistent(mappedBy= "parent")
>    private List<Student> children;
>
> I want to make the group property optional, but GAE refuses to save
> any student entity which does not have group assigned to them. Do you
> have any idea how I can fix it?
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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-java@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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to