withNewSession
Purpose
Provides a way to execute code within the context of a completely new Hibernate session which shares the same transactional (JDBC Connection) resource as the currently bound session.Examples
Book.withNewSession { org.hibernate.Session session ->
// do work
}
Description
Parameters:closure
- A closure the first argument to which is theSession
object