[appengine-java] Re: Convert JDO/JPA POJO to a Datastore Entity

2010-11-01 Thread Didier Durand
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
 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 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.



[appengine-java] Re: Convert JDO/JPA POJO to a Datastore Entity

2010-11-02 Thread George Moschovitis
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  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
>
>
>
>
>
>
>
>  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 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.



[appengine-java] Re: Convert JDO/JPA POJO to a Datastore Entity

2010-11-02 Thread Didier Durand
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 
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  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
>
> >  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 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.



[appengine-java] Re: Convert JDO/JPA POJO to a Datastore Entity

2010-11-02 Thread l.denardo
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  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 
> 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  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
>
> > >  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 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.



[appengine-java] Re: Convert JDO/JPA POJO to a Datastore Entity

2010-11-02 Thread l.denardo
Obviously I mean Entity kind as the first point.

On Nov 2, 3:12 pm, "l.denardo"  wrote:
> 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 
> pagehttp://code.google.com/appengine/docs/java/datastore/dataclasses.html...
>
> If you want to investigate how your entities are mapped you can use
> the Local Testing 
> utilitieshttp://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  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 
> > 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  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
>
> > > >  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 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.