Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What datatypes are supported by Google App Engine's datastore?

I know how to table in google BigTable.I have one doubt regarding this.what are all the datatype supported by google BigTable.

like image 512
user309944 Avatar asked Dec 05 '25 21:12

user309944


2 Answers

Quoting the Class and Field Annotations section from Using JPA with App Engine:

Fields of the data class that are to be stored in the datastore must either be of a type that is persisted by default or expliclty declared as persistent. You can find a chart detailing JPA default persistence behavior on the DataNucleus website. To explicitly declare a field as persistent, you give it an @Basic annotation:

import java.util.Date;
import javax.persistence.Enumerated;

import com.google.appengine.api.datastore.ShortBlob;

// ...
    @Basic
    private ShortBlob data;

The type of a field can be any of the following:

  • one of the core types supported by the datastore
  • a Collection (such as a java.util.List<...>) of values of a core datastore type
  • an instance or Collection of instances of a @Entity class
  • an embedded class, stored as properties on the entity

To define and use Email and PhoneNumber as data types, create entities for them and map them as @OneToOne or make them @Embeddable.

like image 80
Pascal Thivent Avatar answered Dec 07 '25 11:12

Pascal Thivent


David's answer above gives the list of datatypes supported natively by Appengine. But to write real-life applcations with GAE you need more datatypes and patterns supported. Besides JPA, JDO and LowLevel api with their limitations and associated issues are not that practical to use.

After trying them all we have chosen Objectify and never looked back. It is a very efficient Data Access Abstraction layer specifically designed for GAE. Coming back to your question, it is very easy to add serialisers for your own datatypes with Objectify.

Update: 3 years after the original answer, I can say that Objectify is one of the best software library choices I made.

like image 24
husayt Avatar answered Dec 07 '25 09:12

husayt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!