-->
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: Why does Subselect Fetching not work as advertised.
PostPosted: Fri Jul 14, 2006 5:59 am 
Newbie

Joined: Thu Jan 13, 2005 6:24 pm
Posts: 12
I tried to enable subselect fetching on a many-to-one association and got this message:

org.hibernate.AnnotationException: Use of FetchMode.SUBSELECT not allowed on ToOne associations

The documentation, however states that:

19.1.6. Using subselect fetching

If one lazy collection or single-valued proxy has to be fetched, Hibernate loads all of them, re-running the original query in a subselect. This works in the same way as batch-fetching, without the piecemeal loading.

If I understand this correctly the many-to-one should be the single-valued proxy that it is talking about there. What I'd like to do is something simple like map a Person to a Login as many-to-one such that each login has exactly one person. Then I would like to do:

select login FROM Login as login

In which the person association would be loaded as a proxy for later lazy-fetching.

When I do login.getPerson() I would like for ALL person proxies to get loaded at once with a subselect. That is ... something like...

select * from person where id in (select personId from login);

Isn't this what Subselect fetching is supposed to do for me? Why is it not available for Many-to-one and one-to-one???


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.