DevRj
DevRj

Reputation: 468

morphia and gson mixing for mongodb

my question is much more about taking an advice then code issues since i haven't started, i would like to know if it's beneficial to mix Google Gson with Morphia in order to deal with mongodb json objects;

My app will be interacting with an already existing database (that's where the need to gson serialization)

Gson would be mainly used to O/J map the JSON to/from Java POJOs/entities. Morphia to drive connectivity from my Java app to Mongo is there a better approch than this? If so, links and documentations are most welcome

Upvotes: 0

Views: 172

Answers (1)

evanchooly
evanchooly

Reputation: 6233

There's not much downside to that approach. For starters, it sounds like gson is a hard requirement. But annotation-wise, morphia can be pretty lightweight. There's just not a lot of decoration absolutely need for things to work. If you were using jackson, I believe Jongo uses those annotations directly so you could save yourself a little double mapping but i don't think it'll be terrible either way.

Upvotes: 1

Related Questions