0

I want to move from MySQL to MongoDB. In my project, a lot of servlets are being called. There, i begin a user transaction and some operations are executed in the database, both read and write. I use DTOs, DAOs and hibernate.

From what I have read, although hibernate could support MongoDB, I should quit hibernate. Could anyone suggest some key frameworks, which I could use? I am looking for something like hibernate for MySQL.

Also, should I use user transactions with mongoDB? Should I use DAOs? I am sorry about the many questions. I know all these could be done. My question is, what is the proper and effective use of MongoDB in a java project.

3 Answers 3

1

Think if you really need to switch to mongodb. Mongo is document database it does not support transactions under the hood so You will have to cope somehow to get things right. Otherwise if you are sure I suggest:

http://projects.spring.io/spring-data-mongodb/

It has really good integration with mongo and supports event listeners and repositories.

For testing issues I would use:

https://github.com/joelittlejohn/embedmongo-maven-plugin

It is a nice maven plugin to run mongodb for your integration tests without necessity to have database launched on your computer.

Sign up to request clarification or add additional context in comments.

Comments

0

You can start from MongoDb java driver and if it is not enough for you, you can use for example, some ORM or even Spring data

Comments

0

Edit: Kundera is no longer maintained


You can use Object mapper named Kundera. It is an open source project with JPA interface. You can query simply in JPA way (like in RDBMS). Also, you can use the features like GridFS with some modification in your entity class. It supports polyglot persistence too.

For more details: https://github.com/impetus-opensource/Kundera/wiki/Getting-Started-in-5-minutes

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.