Thanks for response,

Still it does not answer the question I have (or may be, I din't explain my
question well).

*Google says "unowned relationship is not supported"*
What does it mean? *How datastore  identify that *it is unowned
relationship**?

As per the doc "*Unowned relationship is: where both objects can exist
independently of their relationship with one another*"

In our example,

- User may or may not have a role assigned to it. And a role may or may not
have been assigned to any user
- Role can be created/deleted independently of user
- User can be created/deleted without any role.
- **List<Role> roles** might be empty in user.

In above example, If I implement it as normal relationship, as shown in
below code, What will happen?.

@Entity
public class User extends BaseEntity {


   @OneToOne(fetch=FetchType.LAZY)
    private List<Role> _roles;


}

public class Role extends BaseEntity {
   @Basic
   String _name;
}

@Entity
@MappedSuperclass
public abstract class BaseEntity implements IEntity<String> {

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
    private String _id;

}


- Can datastore identify it as unowned relationship and through error?
- When *user._roles list is empty* can it support the *save*
- Can it support *delete* on user?

In simple words, how datastore will handle above relationship?
Can I create/delete role and users independent of each other? (user may or
may not have any role) and still the relationship will be handled by
datastore.


Thanks
SN

On Sat, May 1, 2010 at 9:05 PM, datanucleus <[email protected]>wrote:

> You will only find "unowned relationships" terminology in Google docs.
> This "unowned relationships" in the GAE/J docs is where you have a
> field that is a "Key" or a Collection/Map/array of keys. So no *real*
> relation, just some implicit relation by that "key". You have to
> manage these keys yourself, and you tie your code to GAE/J by using
> them.
>
> JDO/JPA specs do not mention such a thing; they only refer to
> relationships ... "owned" relationships ... real relationships. This
> is where a persistable class has a field that is of a persistable
> type, or a Collection/Map/array of a persistable type. i.e 0-N related
> objects. JDO provides managed relationships to keep both sides of a
> bidirectional relation consistent (under some circumstances).
>
> --
> 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
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine-java%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>


-- 
Sudhir Ramanandi
http://www.ramanandi.org

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to