Have parameters in Dao methods to get entities the most efficient way for read-only access

Posted by Blankman on Stack Overflow See other posts from Stack Overflow or by Blankman
Published on 2010-03-16T14:09:31Z Indexed on 2010/03/16 15:01 UTC
Read the original article Hit count: 217

Filed under:
|
|

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
}

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate