Web app dev: one hibernate session per a single web session

I am creating a web application and after playing around with DBVA, I think the the best way to implement a web app with a DBVA generated ORM is to create a unique hibernate session for each web app session.
Does anyone know if this is a good approach and how I would create a hibernate session using the DBVA generated jars?
Thanks

Thank you for your message. You can create the session through %app%PersistentManager.getSession(). In my point of view, running the web app with a unique session is not a good approach. Here are the reasons

1.Multiple Access and Concurrency
In unique session environment, everyone is referencing the same object instance for the same record. The transaction won’t help because the object itself already become invalid before you commit. In multiple session environment, transaction will help when different user updating to the same DB record and you can rollback the changes if commit fails (because each of them is having different instance of the persistent object).

2.Size of the session keep increasing
During execution, the session will associate with the persistent object. The number of object associated will keep increasing unless you remove it manually. This lead to increasing size of the session. Holding a group of small session is better than having a giant session because create session is a light weight operation, and normally will create and close session for each operation.

For more information about the session, please visit http://www.hibernate.org/116.html#A35. If you have any further questions, please feel free to contact us again.

Best regards,
Rain

Not sure if you understood my proposed approach: a seperate hibernate session for each web session.

[quote=Rain]Thank you for your message. You can create the session through %app%PersistentManager.getSession(). In my point of view, running the web app with a unique session is not a good approach. Here are the reasons

1.Multiple Access and Concurrency
In unique session environment, everyone is referencing the same object instance for the same record. The transaction won’t help because the object itself already become invalid before you commit. In multiple session environment, transaction will help when different user updating to the same DB record and you can rollback the changes if commit fails (because each of them is having different instance of the persistent object).

2.Size of the session keep increasing
During execution, the session will associate with the persistent object. The number of object associated will keep increasing unless you remove it manually. This lead to increasing size of the session. Holding a group of small session is better than having a giant session because create session is a light weight operation, and normally will create and close session for each operation.

For more information about the session, please visit http://www.hibernate.org/116.html#A35. If you have any further questions, please feel free to contact us again.

Best regards,
Rain[/quote]

Sorry, I meant 1 hibernate session per 1 user session

[quote=Anonymous]Not sure if you understood my proposed approach: a seperate hibernate session for each web session.

[quote=Rain]Thank you for your message. You can create the session through %app%PersistentManager.getSession(). In my point of view, running the web app with a unique session is not a good approach. Here are the reasons

1.Multiple Access and Concurrency
In unique session environment, everyone is referencing the same object instance for the same record. The transaction won’t help because the object itself already become invalid before you commit. In multiple session environment, transaction will help when different user updating to the same DB record and you can rollback the changes if commit fails (because each of them is having different instance of the persistent object).

2.Size of the session keep increasing
During execution, the session will associate with the persistent object. The number of object associated will keep increasing unless you remove it manually. This lead to increasing size of the session. Holding a group of small session is better than having a giant session because create session is a light weight operation, and normally will create and close session for each operation.

For more information about the session, please visit http://www.hibernate.org/116.html#A35. If you have any further questions, please feel free to contact us again.

Best regards,
Rain[/quote][/quote]

Basically is OK to have hibernate session per user session.