Reputation: 1089
is there any ORM tool/framework for mongoDB with java and also support maven, so that it will be helpful to apply constraints, use of cursers in database operations?
Upvotes: 7
Views: 7391
Reputation: 1254
try MongoDBExecutor. It will definitely increase the productivity of development. Here is simple sample about CRUD:
@Test
public void test_crud_by_id() {
Account account = createAccount();
account.setId(ObjectId.get().toString());
// create
collExecutor.insert(account);
// read
Account dbAccount = collExecutor.get(Account.class, account.getId());
// update
dbAccount.setFirstName("newFirstName");
collExecutor.update(dbAccount.getId(), N.asMap(FIRST_NAME, dbAccount.getFirstName()));
// delete
collExecutor.delete(dbAccount.getId());
// check
assertFalse(collExecutor.exists(dbAccount.getId()));
}
Declaration: I'm the developer of AbacusUtil
Upvotes: 0
Reputation: 4596
You can use morphia.
It is a wrapper over mongo-java-driver and works well in the production environment. It is well documented and supports raw queries as well.
Also, well SO community support
Upvotes: 0
Reputation: 7546
To work with Mongo Db at grass root level I found http://howtodoinjava.com/2014/05/29/mongodb-selectqueryfind-documents-examples/ link very helpful
Upvotes: 0
Reputation: 900
See this presenation on slide share http://www.slideshare.net/mongodb/java-persistence-frameworks-for-mongodb
Upvotes: 2
Reputation: 394
This is what you need: http://www.infoq.com/articles/mongodb-java-orm-bcd It is maven-based.
Upvotes: 2
Reputation: 12367
There are some. Start reading:
http://www.mongodb.org/display/DOCS/Java+Language+Center
As for maven support, just look up libraries in mvnrepository.com ( most of them will be there )
Upvotes: 7