-->
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.  [ 2 posts ] 
Author Message
 Post subject: EAGER fetching behavior of Criteria
PostPosted: Thu Aug 12, 2004 6:26 am 
Newbie

Joined: Thu Aug 12, 2004 5:53 am
Posts: 4
Location: Japan
Hibernate version: 2.1.6
Name and version of the database you are using:Oracle 10g

A-->B is one-to-one, constrained=false relation. The code

Code:
s.createQuery("from A a left join fetch a.b").list();


works perfect for me (makes only one select always), but in the same configuration, the following code

Code:
s.createCriteria(A.class).setFetchMode("b", FetchMode.EAGER).list();


results in redundant select for b when there is no B corresponds to A. DEBUG says,

    Hibernate: select a.ID, a.NAME, b.ID, b.NAME from A a left outer join B b on a.ID=b.ID
    DEBUG - object not resolved in any cache [B#0]
    DEBUG - Materializing entity: [B#0]
    DEBUG - about to open: 0 open PreparedStatements, 0 open ResultSets
    DEBUG - select b.ID, b.NAME from B b where b.ID = ?
    Hibernate : select b.ID, b.NAME from B b where b.ID = ? <--- NO NEED
    DEBUG - preparing statement
    DEBUG - binding '0' to parameter: 1
    DEBUG - processing result set
    DEBUG - done processing result set (0 rows)


Is there any suggestion?

Sorry for my poor English.

Thanks you in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 12, 2004 6:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Please submit a test case to JIRA. This looks like a bug in something that *should* work.


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

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.