Hi,
i am trying to use a loader (which calls a stored procedure) for an entity property, which is an arraylist holding instances of another entity (fetchtype is EAGER, relation is unidirectional).
The loading of the entities in the list is done, but the loaded entities in the arraylist seem to be disassociated from the holding entity. When i try to access the entities in the arraylist outside of the bean that loads my entities i get
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.bwin.autotest.mqcif.internal.TestResult.attachments, no session or session was closed
The annotated property:
Code:
@OneToMany(fetch=FetchType.EAGER)
//@JoinColumn(name = "AT_TESTRESULT") // tried it with and without it
@IndexColumn(name = "AT_POSITION")
@Loader(namedQuery = "GET_ATTACHMENTS_OF_RESULT")
private List<TestAttachment> attachments;
The named Query annotation:
Code:
@NamedNativeQuery(name = "GET_ATTACHMENTS_OF_RESULT", callable = true,
query = "{call TES.PAC_MQCIF.GET_ATTACHMENTS_OF_RESULT(?,?1)}",
resultClass = TestAttachment.class)
which calls the following statement:
Code:
select * from testattachment where at_testresult = ?;
Thanks in advance
Didi