On Wed, Jan 27, 2010 at 2:44 AM, datanucleus <[email protected]> wrote:
>
> Exposing "Key" to a user is not (in my opinion) a requirement for
> *providing* a JDO impl on GAE/J. Other datastores have their own
> internal "id" and we don't expose theirs (e.g db4o).
...
> And, of course, all of that (endless) configuration is optional. There
> is very little that is mandatory, like declaring what class(es) can be
> persisted. Evidently, at some point, you're going to actually define
> *what* is aesthetically displeasing about JDO annotations, and you
> could do that with reference to JPA annotations too (where you'll find
> many many more annotations, and with delightfully RDBMS specific names
> too) :-) Such annotations obviously had to provide backwards
> compatibility naming with JDO 1.0 and JDO 2.0 specs, and as the saying
> goes, if you think you can do better ...

Going back to the original poster's request, would you like to provide
JDO (on GAE/J) equivalents of the annotated entities that described in
BAD IDEA #1, BAD IDEA #2, and GOOD IDEA?  That is:

 1) A one-to-many relationship stored as a Photo key array in the Album entity
 2) A one-to-many relationship stored as an Album key in the Photo's key parent
 3) A one-to-many relationship stored as an Album key property in a Photo entity

(The BAD IDEAS are bad for a photo album app, but they are perfectly
good ideas in other apps so they're quite relevant to this
discussion).

Aesthetics are of course subjective, but you're handicapped right out
of the gate when the first few lines of code look like this (taken
from the first full example class of "Defining Data Classes" in the
GAE/J docs):

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Employee {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;
    ...

I'm sure there are perfectly good historical reasons for why things
are the way they are, but nevertheless the accumulated load of
oddly-named things and inconsistent placement makes the learning curve
excruciating.  Why do I define the identity type in these other
annotations and not in @PrimaryKey??

JPA is a little better with @Entity and @Id, but you will have a hard
time finding someone that wouldn't rather read and type the Objectify
version:

public class Employee {
    @Id Long id;
    ....

(@Entity is unnecessary)

Jeff

-- 
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