A desktop version of our software uses a relational database with Java Persistence API. We want to port the software to Android while keeping the relational database model. So is it possible to integrate a relational database with Java Persistence into an Android app?
1 Answer
Java Persistence as in Hibernate, EclipseLink, etc., no. There are however lightweight ORM solutions that work on Android such as OrmLite if you really feel you need to use ORM.
4 Comments
Hank
I looked at OrmLite but it won't work for us because while looking around in the documentation it stated, "ORMLite does not enforce the many or one relationship nor does it use any of the annotation fields," and we use the many to one and one to many relationships.
Nikolay Elenkov
You might find an ORM that supports those and works on Android, but you should really forget about using your model as is. Even if you manage to get it to work, it will probably be quite slow. Your best bet is to keep the domain model, and more or less give up on ORM.
Hank
What would be the difference if I kept the domain model and gave up on ORM?
Nikolay Elenkov
Porting should still be relatively easy (same model) and you would not need to depend on JPA.