Generally, if someone is opposed to using hibernate, the first reason is the performance problem of hibernate.
The test result is that the time consumption of Hibernate is basically 1.4 times that of JDBC. Among them, I think a big problem is the memory usage of the cache. The most basic problem is that hibernate will save all newly inserted objects in the session-level cache, in fact, these newly inserted objects are not immediately used in general web systems.
To solve this problem, hibernate3.2 adds the statelesssession implementation. The statelesssession provides the command-oriented API, which extracts all the objects that are detached. It is irrelevant to the cache, dirty-checking, association, collection, and interceptor.
Its insert/update/delete/select operations can be considered as common JDBC operations. Example in reference is as follows:
Statelesssession session = sessionfactory. openstatelesssession ();
Transaction Tx = session. begintransaction ();
Scrollableresults MERs = session. getnamedquery ("getcustomers ")
. Scroll (scrollmode. forward_only );
While (customers. Next ()){
Customer customer = (customer) MERs. Get (0 );
Customer. updatestuff (...);
Session. Update (customer );
}
TX. Commit ();
Session. Close ();
Unfortunately, gavinking does not have statelesssession in SDO mode.