|
Motivation
The motivation behind Morphia.
MotivationMany visions have been brought together on this project. As with any project where there are many contributors this project has seen lots of different ideas. The over-arching goal is to provide a fast, easy and obvious way to use the strengths from java with the features of mongodb. Generally the motivation has come from wanting to work with Plain-Old-Java-Objects (POJO) and to remove some of the knowledge needed to store data in mongodb while providing more fluent and "javaesk" interfaces to the data. The basic java driver provides a view of the data as one of nested Map<String, Object> which is a very dynamic, but unfortunately less java-like, view of data. The mongodb driver provides a very malleable and consistent view of how to perform queries; however it is somewhat complicated (and cumbersome), but is very complete. The goal of this project is to keep all that control, and power, while making it much easier to integrate with java's principles and best practices. The basic goals come down to these:
For example, if we're storing information about hotels, we're likely to create a Hotel class, and add fields like title, description, address, rating, pictures, etc. It is easy to instantiate Java classes and add data to the fields, but when it comes to actually persisting the data we usually map the object to an external data source (such as database, xml files, etc.). This often involves a lot of error prone boiler plate code (e.g. mapping from JDBC result set, XML elements, etc.). The same applies, of course, when we need to map the Java object to the external data source: more boiler plate code. We already have good object mapping frameworks for relational databases and JDBC, of JPA and Hibernate. The vision of Morphia is to provide something similar for MongoDB (http://mongodb.org). | |