Is it advisable to use Hibernate with mongodb? Could anyone please explain how to integrate this?
1 Answers
Hibernate is normally used to persist (Java) objects into a relational database. Normally every class persists into its own table. MongoDB on the other hand is not a relational database, but rather a document database. Basically this means that it stores aggregates, collections of coherent but possible unstructured objects in a single "document" - an object which is stored in BSON format, which is similar to JSON. It also defines a query language to search through the documents in the database. This language also has quite a different structure than the average query in Hibernate HQL or even SQL.
Hence MongoDB doesn't manage data and relationship between data in the same manner a relational database does. Now your question is about using Hibernate with MongoDB. That sounds a bit like you want to use MongoDB in a relational manner. Of course you could do that, but that is not what MongoDB is designed for.
If you however are looking for API's that help you access MongoDB easier, the following question might be of much interest to you: Hibernate with MongoDB. No sense in repeating that here.

- 1
- 1

- 444
- 6
- 9