Newbie question(s) - Creating my first entity; where does it go?

8 views
Skip to first unread message

Caleb Wardell

unread,
Jun 22, 2011, 3:30:06 PM6/22/11
to google-a...@googlegroups.com
Hello,

I'm brand new to coding, and even newer to using Google apps Engine and I'm confused about create my database and populating it.

I've gone through the documentation (http://code.google.com/appengine/docs/java/datastore/overview.html) and I think I get the idea, but when I went to try it out I got very lost.

I am attempting to use Java to create an entity using the sample code:
import java.util.Date;
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;

    // ...
    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();

    Entity employee = new Entity("Employee");
    employee.setProperty("firstName", "Antonio");
    employee.setProperty("lastName", "Salieri");
    Date hireDate = new Date();
    employee.setProperty("hireDate", hireDate);
    employee.setProperty("attendedHrTraining", true);

    datastore.put(employee);
It is my understanding I would also need an Employee class.  My questions are:

1.  Where should the Employee class live in my project?  (using Eclipse)
2.  Is the above code a new Java class?  Where would that sample code go to create said employee?

Thanks for any help, and your understanding while I learn!

-Caleb
 


Reply all
Reply to author
Forward
0 new messages