软件介绍
MJORM 是一个mongoDB 的"ORM"映射表,类似Hibernate 的ORM,操作,配置使用比较简单,MJORM有其自身的MQL也对应Hibernate的HQL.用过Hibernated的开发者应该会很熟悉这种概念.如果是从MYSQL+Hibernaer的这种开发模式转入mongoDB的开发,那MJORM应该是不错的选择,具体内容看详细介绍.
示例代码:
// connect to mongo
Mongo mongo = new Mongo(new MongoURI(uri)); // 10gen driver
// create object mapper and add classes
AnnotationsDescriptorObjectMapper objectMapper = new AnnotationsDescriptorObjectMapper();
mapper.addClass(Person.class);
mapper.addClass(Address.class);
// create MongoDao
MongoDao dao = new MongoDaoImpl(mongo.getDB("dbName"), objectMapper);
为你推荐: