Posts mit dem Label Google App Engine werden angezeigt. Alle Posts anzeigen
Posts mit dem Label Google App Engine werden angezeigt. Alle Posts anzeigen

27.06.2011

Objectify: Persistenz auf Google App Engine

So wünscht man sich eine Persistenz-Bibliothek: lib einbinden, put, delete oder query aufrufen - fertig!
Objectify ist ein sehr dünner Wrapper um die native API des Google Datastore. Damit können nun POJOs und nicht mehr nur Entities gespeichert werden. Keys werden automatisch erzeugt, Transactionen funktionieren wie erwartet und Relationen und mehrwertige Attribute werden auf die offensichtliche Weise angeboten.
Schliesslich können die Objekte aus dem Store 1:1 in GWT genutzt werden.
Wenn also eine Portierung auf JPA oder JDO nicht in Sicht ist und man einfach nur problemlos Daten speichern will: Objectify statt JPA, JDO oder native nutzen!

From: http://ping.fm/s8CFJ

01.11.2010

Google Datastore native API

Recently I ran into the requirement of storing data from a Google App Engine application.

After having studied the docs, wondering a little why the older JDO obviously was preferred over JPA, I was happy seeing my good old APIs turning in. So quickly I turned the datamodel into a JDO-based one, only to run into several heavy problems, e.g. in model unowned 1:n-Relations and such.

I ended up storing only ids in the associations and dereferencing them myself later, and...
Believe me, it was not a good feeling.

So.
After coming to this point again now, I decided to give the native API a try.
And phew - that was a relief.
Only now I learned the the datastore more or less handles persistent hashmaps with keys.
That I was able to understand and handle properly.
Of course I had to introduce a mapping layer here, too. But that one was much more explicit and it is much easier to understand what is going on.
Again I have the feeling that frameworks are my enemies - no, just kiddin'.

But really - it is so simple to store and retrieve data using the low-level API...
Give it a try!