Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Because sending possibly uninitialised Proxies, especially collections, in the view layer and triggering hibernate loading from there can be troubling from both a performance and understanding point of view.</p> <p><em>Understanding</em>:</p> <p>Using OSIV 'pollutes' the view layer with concerns related to the data access layer.</p> <p>The view layer is not prepare to handle a <code>HibernateException</code> which may happen when lazy loading, but presumably the data access layer is.</p> <p><em>Performance</em>:</p> <p>OSIV tends to tug proper entity loading under the carpet - you tend not to notice that your collections or entities are lazily initialised ( perhaps N+1 ). More convenience, less control.</p> <hr> <p><em>Update:</em> see <a href="http://blog.frankel.ch/the-opensessioninview-antipattern" rel="noreferrer">The OpenSessionInView antipattern</a> for a larger discussion regarding this subject. The author lists three important points:</p> <blockquote> <ol> <li>each lazy initialization will get you a query meaning each entity will need N + 1 queries, where N is the number of lazy associations. If your screen presents tabular data, reading Hibernate’s log is a big hint that you do not do as you should</li> <li>this completely defeats layered architecture, since you sully your nails with DB in the presentation layer. This is a conceptual con, so I could live with it but there is a corollary</li> <li>last but not least, if an exception occurs while fetching the session, it will occur during the writing of the page: you cannot present a clean error page to the user and the only thing you can do is write an error message in the body</li> </ol> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload