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