Have parameters in Dao methods to get entities the most efficient way for read-only access
- by Blankman
Allot of my use of hibernate, at least for that data that is presented on many parts of the web application, is for read-only purposes.
I want to add some parameters to my Dao methods so I can modify the way hibernate pulls the data and how it handles transactions etc.
Example usage:
Data on the front page of my website is displayed to the users, it is read-only, so I want to avoid any session/entity tracking that hibernate usually does.
This is data that is read-only, will not be changed in this transaction, etc.
What would be the most performant way to pull the data?
(the code below is c#/nhibernate, I'm implementing this in java as I learn it)
public IList<Article> GetArticles()
{
return Session.CreateCriteria(typeof(Article))
// some where cluase
}