-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Using a loader for an arraylist property
PostPosted: Mon Jul 26, 2010 8:07 am 
Newbie

Joined: Mon Jul 26, 2010 6:50 am
Posts: 6
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.