Hello all! I am new to GAE and have a pretty simple domain model that
I'm trying to persist. I am creating an Event(with a generated ID) and
a User(with a pre-defined ID) which is hosting the event. This is a one
to one relationship owned by the Event(@See below for code snippets).

Upon commiting the transaction, I'm getting an exception which
states "Error in meta-data for User._id: Cannot have a java.lang.Long
primary key and be a child object (owning field is Event._host)." I did
some searching and came across this[1] post which suggested that I need
to change my key from a java.lang.Long to a
com.google.appengine.api.datastore.Key.

Since "The App Engine Java SDK includes an implementation of JPA 1.0
for the App Engine datastore"[2]... I don't really need to use these
internal GAE classes to describe this mapping do I? Maybe I'm being a
bit naive here, but I have a hard time believing that this
requirement/limitation is due to the underlying database not being a
relational database.

Hopefully someone can shed some light on my findings.

Thanks,
Rick

@Entity
public class Event {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
Long _id;

@OneToOne
User _host;
...
}


@Entity
public class User {
@Id
Long _id;
...
}

[1] http://code.google.com/p/datanucleus-appengine/issues/detail?id=26
[2]http://code.google.com/appengine/docs/java/datastore/usingjpa.html

-- 
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=en.

Reply via email to