Recently implemented SDO's Das implementation and used the scrollableresult function of Hibernate to record the code analysis results:
1) Paging
Query q = session. createquery ("from cat as C ");
Q. setfirstresult (200 );
Q. setmaxresults (100 );
List L = Q. List ();
Paging has nothing to do with scrollableresult and is fully reflected in the API. Line 1,543rd of org. hbigoal. loader. loader is as follows:
If (uselimit ){
SQL = dialect. getlimitstring (
SQL. Trim (), // use of trim () Here is uugly?
Useoffset? Getfirstrow (selection): 0,
Getmaxorlimit (selection, dialect)
);
}
That is, use different dialect for paging. This is a normal consideration. It is rare that the hibenrate setting varies with the max values of different databases. For example, maxresults of a database indicates the maximum number of records, while another database may indicate the maximum number of records.
2) scrollableresult
In jdbc2.0, it is defined as follows:
Statement stmt = con. getstatement ("cursor type", "Record Update permission ");
Cursor type:
Resultset. type_forword_only: can only move forward
Resultset. type_scroll_insensitive: Scroll. However, it is not affected by changes made to the database by other users.
Resultset. type_scroll_sensitive: Roll. This record also changes when other users change the database.
Record Update permission:
Resultset. concur_read_only, read-only
Resultset. concur_updatable, updatable
For scrollmode, Hibernate uses resultset. type_scroll_insensitive by default. Of course, you can specify yourself in the API
The desired mode.
For update priv, Hibernate uses resultset. concur_read_only, read-only.
If you are using an external connection, you must specify
<Property name = "hibernate. JDBC. use_scrollable_resultset"> true </property>
Of course, this configuration does not matter if you do not need an external connection.