Requirements for an ORM I'm looking for:
Dynamic SQL with:
1.1. SQL injection prevention
1.2. named parameters
1.3. capability to set where clause conditions conditionally
1.4. capability to call stored procedures and functions
Allows me to set important ResultSet parameters such as the fetch size
Allows me to control when to close the ResultSet
Allows me to iterate through the result without waiting for all rows to be fetched from connection or ResultSet. This is because of the following
there will be queries that may return millions of rows (pagination will not be done in the DB using rownum or select top)
I don't want to wait for millions of rows to be loaded first in the memory before I can start doing something about the rows that already may have been fetched by the ResultSet
we want to control where and when we should stop getting rows from the connection or ResultSet while iterating through the rows
Please include some code snippets to demonstrate this.
For (3), I should be able to do this without having to wait for a single record to be returned. If only the ORM can return me the resultSet and allow me to manually scroll through the records by letting me call the .next() it would perfectly fit what I'm looking for.
Maybe I'm just looking for a template-based way to generate SQL (as powerful as MyBatis) which allows me to simply pass parameters without worrying about SQL injection.