Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Instantiate the LAZY relationship prior to serialization

593615Aug 18 2007 — edited Aug 21 2007
I have several class in my project example:
class X{
@OneToMany(cascade = CascadeType.ALL, mappedBy = "...")
Collection<XChild> child;
}
class XChild{
@OneToMany(cascade = CascadeType.ALL, mappedBy = "...")
Collection <XChildChild> child_child;
}
class XChildChild{
}

When I request object X I want to get XChild and their XChildChild but
I don't want to use EAGER fetch type.

How to made query?
Sqting sql = "select x from X as x join fetch x.child child join fetch child.child_child"
dont work.

Exception is:
An attempt was made to traverse a relationship using indirection that had a null Session. This often occurs when an entity with an uninstantiated LAZY relationship is serialized and that lazy relationship is traversed after serialization. To avoid this issue, instantiate the LAZY relationship prior to serialization.


Thanks a lot.
D.S
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 18 2007
Added on Aug 18 2007
1 comment
2,755 views