*[Edit]: The Bug 'Label Job has encountered a problem' is fixed with 6.5. We return null, since the below explanation is still true.*
Lazy evaluation of entity beans is not supported with the ivy persistency.
As described in the documentation, **ivy persistency always works with unmanaged entity beans**. Lazy loading is only supported with managed entity beans. A beans is managed as long the referenced session (link to the db/transaction) is open - means the entity is managed (i.e. cached) in the session.
**How to solve:**
Example: Table Company has a 1:n relation to Invoices.
- First question: is the lazy loading required? Do the Company entity need a list of all invoices or can it be replaced/reduced to the @ManyToOne relation on the Invoice entity? <br>To get the list of all invoices of a company a repositoy method has to be implemented, e.g. `InvoiceRepository.readAllOfCompany(Company c) : List< Invoices >;`
- Write own repository method and open/close the session inside this method. As long the session is open, as long the entiries are managed and lazy loading is supported. Always ensure with a try-finally block that the session gets closed. Otherwise, the connection to the database remains open and the allowed number of connections is limited. An example could be find [here]
[1].
[1]: http://answers.axonivy.com/questions/1102/how-to-use-jpa-entity-manager-instead-of-ivy-entity-manager