tenwit wrote:
First question would have to be: why transactions? They're not useful for read-only access. The purpose of a transaction is to ensure that non-atomic updates are performed atomically. If you're doing 60k reads and 0 writes, don't bother with a transaction.
Session strategies should almost always be "treat it like a hot potato": throw it away before it burns your hand. The one exception (to my mind) would be exactly what you're describing: purely read-only access on strictly immutable data. So long as you don't mind hogging a JDBC connection, then there's no real reason to get rid of the session. Use a separate session for your read-write access, and close it after every (short) transaction.
I don't agree with anything you wrote here.
(1) Always use transactions.
(2) The best scope of a session is "conversation" ... see Seam docs if you don't understand
(3) Sessions do not hog a JDBC connection
(4) Never share sessions between multiple threads or multiple conversations
To trobison: stop paying attention to microbenchmarks, they will ALWAYS lead you wrong! Don't preoptimize. Follow the standard recommended ways of doing things, and optimize actual working application code that causes a problem in production. Don't tie yourself in knots to eek tiny gains out of silly microbenchmarks that will never ever be noticed in a production system.