hibernate/hibernate-ogm — pull request #318 by gunnarmorling (2014-05-12 15:18:38+00:00)
Title: OGM-506 PREVIEW "Native object" queries for MongoDB

(Based on top of https://github.com/hibernate/hibernate-ogm/pull/317; that's the [actual diff](https://github.com/gunnarmorling/hibernate-ogm/compare/hibernate:OGM-480...OGM-506))

Allows to create queries in form of {{DBObject}} instances and return managed entities/projections for MongoDB:

DBObject queryObject = new BasicDBObject();
queryObject.put( "$query", new BasicDBObject( "author", "Oscar Wilde" ) );
queryObject.put( "$orderby", new BasicDBObject( "name", 1 ) );

NoSQLQuery query = session.operationsFor( MongoDB.class ).createNativeQuery( OscarWildePoem.class, queryObject );
List result = query.list();

I'm interested in more general high-level feedback; I'll polish some details subsequently if you guys are ok with the general approach. Of interest in particular is the new {{OgmSession#operationsFor()}} API. I'd add something similar to {{OgmEntityManager}}.

The PR also unifies the query execution paths for MongoDB (gets rid of `MongoDBQueryImpl`) and adds support for setFirstResult()/`setMaxRows()`.