-->
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.  [ 3 posts ] 
Author Message
 Post subject: associationPath in Criteria#setFetchMode
PostPosted: Wed Jul 26, 2006 11:22 am 
Newbie

Joined: Mon Jun 19, 2006 5:35 am
Posts: 14
Hello,

this topic is atually related to http://forums.hibernate.org/viewtopic.p ... d568f4e031, but the that thread seems to be overloaded with different issues, so I'm creating a new one...

The [b]contract [/b]for Criteria#setFetchMode(String associationPath, FetchMode mode) is as follows:

Specify an association fetching strategy for an association or a collection of values.
Parameters
* associationPath - a dot seperated property path
* mode - The fetch mode for the referenced association

However, it seems to me that only the "first level" in an association path is really evaluated:
* setFetchMode("orders", FetchMode.SELECT) will work
* setFetchMode("orders.product", FetchMode.SELECT) will have no effect

I've been peeking into the Hibernate Source Code and it seems that CriteriaImpl#getFetchMode is ever only called for the first level in an association path, so that's probably the reason why its not working for paths with more than one level.

Is that assumption corrrect ?

If so, I think there are the following options:

* Update the javadoc comments for Criteria#setFetchMode to match the reality
* Read all fetchmode overrides from CriteriaImpl#fetchModes

Alternatively, are there any workarounds ?

Thanks
Holger


Top
 Profile  
 
 Post subject: ManyToOne#fetchMode
PostPosted: Wed Jul 26, 2006 11:35 am 
Newbie

Joined: Mon Jun 19, 2006 5:35 am
Posts: 14
Side note: It might be sufficient for me if I could set the value of ManyToOne#fetchMode (more precisely ToOne#fetchMode) via Hibernate Annotations or programatically.

But the FetchType class from EJB 3 Persistence only knows EAGER and LAZY.

Any comments on this ?

Thanks and best regards
Holger


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 27, 2006 5:44 am 
Newbie

Joined: Mon Jun 19, 2006 5:35 am
Posts: 14
(Talking to myself) - it seems that

@Fetch(value=FetchMode.SELECT)

does the trick. However it would be great if the fetch types could also be set programatically at run-time.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.