Project

General

Profile

bug #7046

Updated by Andreas Kohlbecker over 6 years ago

In #6687 the open session per view pattern has been implemented for the cdm-vaadin mvp framework.  

 It turned out that this approach is causing problems since a session opened in one view needs to be reused in multiple request threads. In order to accomplish this it is always required to have a transaction open for the whole lifetime    of the view which causes an open database connection for the same time. The database connection pool is limited to a maximum amount of open connections    and can thus run out of available connections when too many views are opened at the same time. This situation is becoming worse if vaadin views are not destroyed fast enough so that the resource are being freed quickly (#7047). quickly.  

 As explained in [[VaadinNotes#Managing-Hibernate-sessions]] the best way to avoid LazyInitializytionExceptions is to use DTOs or entity bean initialization strategies. This will not only allow to free database connections as quickly as possible but also avoids managing long transactions logs at in the database itself. 

 TODO: 

 * remove all    open session per view pattern code 
 * use bean init-strategies to avoid LazyInitializytionExceptions 
 * in order to save edited entities, open a new clean session, merge the modified entity and flush and commit 
   * In future we may want to check for itermediate modifications of the entity by other users. I case a modification by someone else is detected the application will present a dialog to inform the user that someone else work will be overwritten. The dialog should present a table of all conflicting properties allowing the user to resolve the conflict. ---> create ticket 
  

Back