le Wadablog

Aller au contenu | Aller au menu | Aller à la recherche

lundi 8 avril 2013

On BatooJPA on the Andoid platform

As you may know, I've done more serverside than mobile dev.
Therefore, I was looking for a way to unite the JEE serverside part and the mobile app.
You know, not having to code same things twice. 
Thus the idea to share code between the two. Not the UI of course, but the JPA entities.

I found BatooJPA (https://github.com/BatooOrg/BatooJPA) which is a competitor to Hibernate and has a sample project for use on Android (it creates data and displays a listview).

Seemed like a good finding however, that does not really match well with me because : 
* Maven based (I used maven 1 and still have nightmares) 
* maven plugin to build & install 
* eclipse 3.7 only 
* uses H2 instead of SQLite 
* Android sample not maintained anymore 
** has to tweak it to make it recognized as an Android project in Eclipse 
** a dependency seems not to be in maven central anymore 
* heavyload APK & app (several Mb) 
* class not found exception at runtime 
As the sample was not working out of the box, I had to recreate it. 
I did it with http://androidkickstartr.com/ then updated the pom and copy/pasted the code.
Should had been ok but ended with a runtime exception. 
I concluded that its not the time for BatooJPA on mobile yet. 
Its sad because, I wanted to present it at DroidCon Paris ... 
Consequently, I recommend to use BatooJPA on the serverside and to make your mobile app a dumb REST consumer if you can afford your app to need network at all time. 
Alternatively, with a need for local storage, one can write a converter from JPA to ORMLite annotations. 
Or lets fund +Gray Watson and +Kevin Galligan to make ORMLite JPA compliant (hi guys).

mardi 7 février 2012

JPA, EclipseLink and the DOH!

There is something you must know exists when you encounter problems of the "does not work as expected" kind.

This is
<property name="eclipselink.logging.level" value="FINEST"/>
that you must put in persistence.xml to get spammed in your console and check, for example, that all your entities are recognized.

Oh, and prefer 


if you want to master the table name used. 

Else this is your entity that is renamed and you'll get your queries wrong ;-)