# Open Session In View I.

> Example code is available on [github.com/vaadin-on-grails/gorm-open-session-in-view-i](https://github.com/vaadin-on-grails/gorm-open-session-in-view-i).

As described in LazyInitializationException article, we will run into troubles with `LazyInitializationException` when domain object tries to load other object lazily. If the disabling of lazy loading is not what we are looking for and we still want to do lazy fetching, we have to use OSIV (Open Session In View).

Stephan Grundner has implemented adding OSIV filter into the plugin. Thanks to that we can configure `openSessionInViewFilter` property in `VaadinConfig.grovy`.

```java
openSessionInViewFilter = 'org.springframework.orm.hibernate4.support.OpenSessionInViewFilter'
```

Or add older Hibernate filter in case you are using Hibernate 3.

```java
openSessionInViewFilter = 'org.springframework.orm.hibernate3.support.OpenSessionInViewFilter'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ondrej-kvasnovsky-2.gitbook.io/vaadin-on-grails-3/database/gorm/open_session_in_view_i.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
