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: Remove an outer join when I don't need it?
PostPosted: Fri Mar 11, 2005 3:59 pm 
Regular
Regular

Joined: Tue Mar 01, 2005 2:35 pm
Posts: 60
Hibernate version:
3.0rc1

Mapping documents:
Code:
<class name="com.website.Member" table="member">
   <id name="id" type="integer">
      <generator class="identity"/>
   </id>
   <property name="name">
   ...
   <many-to-one name="state" column="state" outer-join="true"/>
</class>


Code between sessionFactory.openSession() and session.close():
Code:
Criteria countCrit = session.createCriteria(Member.class)
            .setProjection(Projections.rowCount())
            .add(Example.create(example));


When this criteria query runs, it does any outer join of state. Now, I know I specified that I was this to happen in the mapping document, but for this ONE time I'd really like this not to happen. In actuality, the search criteria is much more complicated then that and Hibernate is joining in tables all over the place that I don't need. I looked at the fetch types, but there is no type DONT_DO_IT_AT_ALL, so I worry that I may be out of luck. Any suggestions? Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 11, 2005 4:17 pm 
Regular
Regular

Joined: Tue Mar 01, 2005 2:35 pm
Posts: 60
Nevermind. It looks like FetchMode.SELECT does what I want. I'm not sure why, however, since the documentation states:

"Fetch eagerly, using a separate select."

which lead me to believe that a new select statement would be issued imediatly, but it looks like it is not.


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.