Morphia vs Spring Data Mongo [closed]
Asked Answered
W

2

6

I am using Java language.I have to use ORM framework with MongoDb as Database.I have two options Morphia or Spring Data Mongo support.As far i am able to get details , it has been found Spring Data Mongo is better to use since: 1)It provides better DAO out of box inbuilt classes. 2)It has larger community base.

Are there any performance based differences between the two.And if there which one is better in which condition.Also i have requirement of multitenancy .After little search i found that there is very simple custom implementation in Spring Data Mongo to do the same.But in Morphia it is somewhat difficult.Does achieving multitenancy in Morphia diificult(where we need to write a lot of boiler plate code)

Waxwork answered 2/6, 2016 at 7:7 Comment(1)
This is an off topic recommendation question.Mohock
K
10

I have been using Spring-data and I guess I feel somehow it lags as far as maturity is concerned.

It's good for all the practical purposes but the features mongo provides in it's full glory, Spring-data is slow to map that as a driver specially when it comes to aggregation.

As far as performance goes, Spring-data doesn't lag imo.

Sometime I get weird behaviors. Some of their annotation silently doesn't work at some places and for my life I cannot figure out why?

But as an overall implementation it's quite helpful in the way that it provides a robust structure on which your application can grow. It also is easy if you are coming from SQL background since you can draw a parallel between jdbcTemplate and mongoTemplate (though one needs to be cautious)

I seriously considered using Morphia, but dropped the idea since spring-data was providing a more structured ways. Looks like in Morphia we would have to implement some structure on our own which has pros and cons but You usually want to avoid doing it. Since there is a risk of boiler-plate codes, there is a learning curve for 'your' structure for new members.

On the pros side, I am sure Morphia provides more extensiblity leading you to enjoy the ability to suck most out of mongo features. It also is lightweight compared to Spring data.

Kerri answered 30/12, 2016 at 9:9 Comment(1)
https://mcmap.net/q/1632221/-mongodb-java-driver-passing-undefined-as-value/413032 Please read my question, I elaborated this with my experience with Mongo base driver * / *Spring Data Mongo / Morphia in a use case.Ducks
P
7

Morphia is the way to go. Pretty stable, very good Play integration and offers access to all Mongo driver features if you need more torque. Reference resolution, entity embedding are working as expected. You get lifecycle annotations too, which are pretty useful for boilerplate persistence code.

I personally like spring-data because of the hades project... You don't need to implement the DAOs. You just write the interface and spring data automatically provides it to you. However Spring Data Mongodb implementation seems a little buggy in my initial trial. If you have hard dates and is working on a production quality product, probably it is wise to choose Morphia.

Pretension answered 28/12, 2016 at 14:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.