I have a bunch of XML Files which I have parsed into discrete fields.I have wriiten a Spring MVC Application which displays the parsed fields.No I want an ORM which can send these fields to MongoDB as well as query the database on the Spring MVC application side. I went through the ORM's but would like to have your opinion on which ORM to use to Integrate SpringMVC Application with MongoDB,whether it would be Morphia or Java Mongo Driver or can Hibernate work with MongoDB?
Thanks
I've used Morphia in a production environment and it's fairly easy to include if you have a maven based build. Just add this snippet to your build it you want:
http://code.google.com/p/morphia/wiki/Dependencies#Through_Maven
However having used it I would say that if I could do it again then I would either use Spring Data (which supports Mongo) or work directly with the native Mongo Driver using a good basic DAO pattern.
My reasons are as follows: 1) Morphia is not as actively developed as it was before. 2) An O/R mapper is great in the beginning but you will run into lots of new features that you wish you had. For example a common practice is as your data model changes you would like to upgrade old rows whenever you read them with a new field. This is quite simple using native driver but not so much once you abstract it. 3) Morphia also has a known issue (maybe design decision) where it pulls ref collections along with the main parent. In the case of a User object that owns a Mailbox for example it pulls all his messages and caused lots of performance issues. You can get around this with a lazy loading pattern but again more trouble in the long run.
My recommendations: 1) If you must use an O/R mapper and you're already on spring why not go with spring data which has a larger developer community (and a big company) around it. 2) If you are building a larger project go with the native driver.
For smaller projects Morphia is still a good choice and does bring good developer productivity gains. Just bear in mind it's drawbacks.
Hope that helps.