Generally speaking, what Didier says is entirely true.

Mappings are, for my experience, done as follows
*Entity name is the class name without package extension
*Properties names are field names
*Property kind is mapped according to this page
http://code.google.com/appengine/docs/java/datastore/dataclasses.html#Core_Value_Types

If you want to investigate how your entities are mapped you can use
the Local Testing utilities 
http://code.google.com/appengine/docs/java/tools/localunittesting.html

Just do something like this in a test class:

*Persist the object using JDO
*Obtain the datastore service mock thru the testing tools
*Query the datastore for the kind you just created, then you can
iterate on entity property.

The main disadvantage in guessing the mapping is that you lose type
checks: all entities kinds are of one of the core value types, so
you'll need to explicitly convert it from/to your POJO field types.
This is closely related to what Didier emphasizes.

So I too advise you to investigate it as a testing practice, but do
not rely on it in production.
Regards

Lorenzo

On Nov 2, 10:26 am, Didier Durand <[email protected]> wrote:
> Hi George,
> What you are looking for is anyway possible: the JDO/JPA entities are
> stored in datastore as Entities eventually. You'll have to figure out
> (i.e reverse engineer) the mapping between the pojo annotations and
> the corresponding ds structures.
>
> I see 1 big issue: the mapping that you will figure out has no
> guarantee from Google, it can change any time and you may need some
> time to figure out when it changes with risks for the integrity of
> your data.
>
> I would either work at high or low level on a given piece of data but
> not simultaneously if you can't have "guarantees".
>
> regards
> didier
>
> On Nov 2, 8:58 am, George  Moschovitis <[email protected]>
> wrote:
>
> > I know about Objectify but I would like to use a standard solution
> > like JPA/JDO.
> > Even if it is (currently) less efficient than custom solutions.
>
> > -g.
>
> > On Nov 1, 12:32 pm, Didier Durand <[email protected]> wrote:
>
> > > Hi George,
>
> > > Not a direct answer to your question, but if you're looking for
> > > something "lighter" than JDO/JPA, I would encourage you to have a look
> > > at Objectify: it's much closer to DS api than JPA/JDO (and much
> > > simpler and more efficient...) but still provides a good level of
> > > abstraction for efficient programming.
>
> > > Something that could be tried (as Objectify uses some JPA annotation)
> > > is to remap JPA entities onto Objectify entities but it very much
> > > depends on your level of sophistication in the use of JPA.
>
> > > regards
>
> > > didier
>
> > > On Oct 31, 10:08 pm, George  Moschovitis
>
> > > <[email protected]> wrote:
> > > > Is there a way to convert a JDO/JPA POJO to the corresponding
> > > > Datastore Entity? I am sure this functionality exists in the JDO/JPA
> > > > implementation but is this exposed in a public API? (maybe through a
> > > > helper).
>
> > > > This would allow mixing calls to JDO/JPA with calls to the low-level
> > > > API for special case optimizations.
>
> > > > regards,
> > > > George.

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