Newbie playing around with GAE+Maven+Spring+JPA

67 views
Skip to first unread message

DavidFM

unread,
Feb 27, 2011, 7:43:42 AM2/27/11
to Google App Engine
Hello,

I'm totally newbie in GAE, and I come from a relational database
system...

I'm using JPA for persistence just because I'm used to working with
Hibernate...

I have main doubts which are prevening me from figuring out all the
GAE stuff:


I just complete an example application which runs locally with maven
GAE plugin (mvn gae:run) and I'm testing some persistence stuff.

My issue (ignorance) comes from the fact that in one execution I
insert, for example, two users, and in the following I would like to
query them: between executions I don't have "persistence", I have to
insert them again.

The question is basically how to "explore" the datastore locally,
without deploying in GAE, during the development phase, and get some
data inserted and "maintain" this data between the hundreds of
executions needed to test and develop the app.

There has to be some file/s with the data (locally) and populate it
with example data, along with the information I am incorporating
through the forms of the application


I'm not sure if I've explained it well, but I just want to try my
application locally using maven plugin and get the data "persisted"
without having to insert the same entities over and over again.

Thanks in advance,

David

hector@ISB

unread,
Feb 28, 2011, 2:53:45 PM2/28/11
to Google App Engine
I use GAE with Spring and Maven as well, but I'm using the low-level
Entity API instead of JPA. I think the GAE JUnit test classes may be
useful for your development... not sure if this is what you were
looking for, but I hope it is somewhat useful...

Example JUnit test class: http://goo.gl/dn9ka
In this example I am setting up the datastore to contain entities that
I will be querying for through my spring MVC controller.

GAE docs: http://code.google.com/appengine/docs/java/tools/localunittesting.html

Test harness classes:
import
com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import
com.google.appengine.tools.development.testing.LocalServiceTestHelper;
import
com.google.appengine.tools.development.testing.LocalUserServiceTestConfig;

Maven Dependencies:
<dependencies>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-testing</artifactId>
<version>1.4.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId>
<version>1.4.2</version>
<scope>test</scope>
</dependency>
</dependencies>

Hector
Reply all
Reply to author
Forward
0 new messages