- 
    Type:Task 
- 
    Resolution: Done
- 
    Priority:Major - P3 
- 
    None
- 
        4
- 
        🔵 Done
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
Native query is harder for the query is provided by user without internal AST translation (so we know everything semantically). On top of that, Mongo is schema-less (Hibernate native query feature relies heavily on schema, e.g. auto-discovery mechanism), so our support of native MQL might be compromised a lot, with at least the following restrictions:
- we might only support aggregate command (with its $project stage)
- we might only provide limited metadata (e.g. `ResultSetMetadata` returned from `ResultSet`)
- we might support limited query options (e.g. fetch size, limit, query timeout)
Â
This ticket is the first step to implement basic native query, excluding a well-known parameter marker issue from the scope. The scope includes:
- when a valid aggregate native MQL is provided, it could return results as expected
- when limit info is provided by query option (not embedded in MQL command), they should take effect by inserting $skip and $limit aggregate stages internally
- when a valid DML (insert, update and delete) MQL is issued, it will work as expected
Relevant Hibernate ORM docs: https://docs.jboss.org/hibernate/orm/6.6/userguide/html_single/Hibernate_User_Guide.html#sql
- causes
- 
                    HIBERNATE-127 Support NativeQuery.setMaxResults/setFirstResult -         
- Backlog
 
-         
- design is described in
- 
                    HIBERNATE-50 Automatically map ResultSetMetaData for native queries -         
- Backlog
 
-         
- 
                    HIBERNATE-91 implement ResultSetMetadata#getColumnType() to unblock native query non-entity DTO usage -         
- Closed
 
-         
- has to be done before
- 
                    HIBERNATE-61 Native query with parameter marker -         
- Backlog
 
-         
- related to
- 
                    HIBERNATE-126 Support CustomSQL for CRUD operations -         
- Backlog
 
-         
- 
                    HIBERNATE-125 Support setMaxResults and setFirstResult methods on JPA/Hibernate Query API -         
- Closed
 
-         
- links to