view « Session « JPA Q&A





1. Why is hibernate open session in view considered a bad practice?    stackoverflow.com

And what kind of alternative strategies do you use for avoiding LazyLoadExceptions? I do understand that open session in view has issues with:

  • Layered applications running in different jvm's
  • Transactions are committed only at ...

2. How to do ajax-lookup in edit screen in Wicket dropdown with hibernate?    stackoverflow.com

I have the following structue: class A { B value } class B { } The relation between them in mapped bidirectionally in Hibernate, so I get use b.getListOfA() to retrieve all the A's referring B and vice ...

3. Open Session in View with JPA2/Hibernate 3.5.0    forum.hibernate.org

4. Open Session in View    forum.hibernate.org

I have some doubts regarding use of fiilter 1)As per the document on Open Session in View, the init method does a look up for the SessionFactory. From what I have seen, the SessionFactory binds only when I do a new Configuration().configure().buildSessionFactory() which is not done here. public void init(FilterConfig filterConfig) throws ServletException { // Initialize hibernate try { new Configuration().configure(); ...

5. "Open Session in View" Problem    forum.hibernate.org

Hi, Im using a Struts application in which I have a layered architecture consisting of View (JSP), Control (Action classes), Service Layer (business objects), Domain Model (Domain objects) and a DAO layer. Im using the business objects, Managers actually, in Action classes. These managers communicate with the DAO classes by passing Domain objects to and from. The DAO classes internally use ...

6. Open Session in View problems    forum.hibernate.org

Newbie Joined: Sun Apr 04, 2004 6:13 pm Posts: 2 i basicly copied the filter from http://hibernate.org/43.html but when it comes to Code: Context ctx = new InitialContext(); factory = (SessionFactory)ctx.lookup(factoryJndiName); a classcastexception is thrown while trying to cast a org.apache.commons.dbcp.BasicDataSource to SessionFactory Code: java.lang.ClassCastException at org.eg.Persistance.init(Unknown Source) ...

7. open session in view    forum.hibernate.org

How to implement this pattern with servlet filters? At the moment i have a filter class that perform session.connect / session.disconnect. Where session is retrieved with thread local variable to ensure that it is the same hibernate session during all the httpsession. I also have a session listener (servlet session!) to put the hibernate session in the thread. But this pattern ...

8. Open Session in View Help!    forum.hibernate.org

Ok, I thought I had it fuiured out, but I keep getting "net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no session or session was closed" on my jsp page. I'm using the HibernateUtil from caveatemptor and here is my filter: Code: public class HibernateFilter implements Filter { private Logger logger ...

9. Open Session in View: Enforce readonly before View execution    forum.hibernate.org

In your experience would it make sense to mark the HibernateSession object as being read-only at the end of your Controller's execution in MVC design pattern. So that the View can only read data with Hibernate to do its work. When I say mark read-only I mean no new write methods can be called on the session after this point. This ...





10. Simultaneous unique object creation in session-per-view pat    forum.hibernate.org

Hibernate version: 3.0.5 w/ MySQL and Oracle I am dealing with some implementation issues of the "Session Per View" pattern. Two questions: 1) What is the most elegant way to handle attempts to simultaneously create two objects with the same unique key (or natural-id)? For example, in the CaveatEmptor sample app (caveatemptor.HiA-SE-3.1alpha4), what if two users attempt to create the same ...

11. Problems with Session in View    forum.hibernate.org

Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message ljpaff Post subject: Problems with Session in View Posted: Thu Feb 02, 2006 5:23 am Beginner Joined: Wed May 18, 2005 9:48 am Posts: 31 Hi all, my problem is with Session in View code. I ...

12. Open Session In View and Session.close()?    forum.hibernate.org

Hibernate version: 3.1.2 Java Version: 1.5.0_06 I'm taking a look at the Open Session In View code on the Wiki and in the Caveat Emptor application. I noticed that the Servlet Filter never calls session.close() in the Thread Local version. Is there a reason for this? The Session javadoc for close() states " It is not strictly necessary to close() the ...

13. Problem with "Open Session in View" and Portlets    forum.hibernate.org

Author Message TheConfusedOne Post subject: Problem with "Open Session in View" and Portlets Posted: Wed Sep 05, 2007 8:48 pm Newbie Joined: Wed Sep 05, 2007 6:34 pm Posts: 13 Hi! I have been using the Open Session in View pattern as described here with hibernate 3.2.4.sp1 and in a portal environment for quite a while without any problems. ...

14. When does Open Session in View become "un-scalable"    forum.hibernate.org

I have an application that currently uses OSiV - and works brilliantly. I now am going to "upgrade" this application from 5 users to potentially 1000+ users. 2 questions: 1) At what point do you say I need to go n-tier and forget the OSiV pattern? 2) Currently my app has one MS server machine running Tomcat & MS Sql Server. ...

15. Open session in view    forum.hibernate.org

Well, open session in view allows you to access the data you need, when you need it. Otherwise, you need to anticipate all of the data your view will need, and then close the session. Having the back end try and figure out the needs of the front end IS a bad design. Open session in view is very efficient.