JPA Portability Between MYSQL and MongoDB

272 views Asked by At

If I am using JPA with MongoDB and later if I would like to change database to MYSQL, how easy to do switch from MongoDB to MYSQL?

Reason why I am asking this because I understand that MongoDB is non relational and MYSQL is relational database. So at the time of changing database do I need to make lots of changes in Entity classes?

1

There are 1 answers

2
Neil Stockton On BEST ANSWER

First thing that must be said is that JPA was designed around RDBMS only, and so some aspects (e.g query language, joins) are not suited to "other types" of datastore. Consequently it is all down to how a particular implementation handles things.

I know that with DataNucleus JPA the impact is very small, in terms of configuration needed. Typically if an RDBMS-only configuration is seen when using MongoDB it simply ignores the setting, hence it is largely transparent.