-->
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.  [ 4 posts ] 
Author Message
 Post subject: Fetch type select but not lazy in ManyToOne annotation
PostPosted: Thu Dec 15, 2005 5:42 am 
Newbie

Joined: Mon Dec 20, 2004 9:47 am
Posts: 3
I can't figure out the way how in annotations reproduce the situation, which in mappings describes as
Code:
<many-to-one
....
fetch="select"
lazy="false"
>
...

I.e. I need to use "select"-type fetching (specified for the particular property), but do not want referenced object be lazy and enhanced by cglib.

@ManyToOne annotation has only fetch = FetchType.EAGER | FetchType.LAZY property. First variant leads to outer join in query, the second makes the referenced object lazy.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 15, 2005 12:39 pm 
Newbie

Joined: Tue Dec 13, 2005 9:13 am
Posts: 4
Exactly what i need too.
Please make it possible to annotate this.
since this works for me if I have fetchtype.eager annotated on the label.history and content.data.
Code:
Criteria criteria = getCriteria();
criteria.setFetchMode("label.history", FetchMode.SELECT);
criteria.setFetchMode("label.meta", FetchMode.SELECT);
criteria.setFetchMode("label.content.data", FetchMode.SELECT);


my problem is that i cant use outer join fetching since history tupels and data tupels must be ordered in a List and must be able to contain duplicates.

the label objects must always be eagerly fetched, with get(), load(), HQL, or criteria or walking the references.

like the manual states:
Quote:
The fetch strategy defined in the mapping document affects:
* retrieval via get() or load()
* retrieval that happens implicitly when an association is navigated
* Criteria queries
* HQL queries if subselect fetching is used


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 15, 2005 12:53 pm 
Newbie

Joined: Tue Dec 13, 2005 9:13 am
Posts: 4
must cite the manual a little more:
Quote:
We have two orthogonal notions here: when is the association fetched, and how is it fetched (what SQL is used). Don't confuse them! We use fetch to tune performance. We may use lazy to define a contract for what data is always available in any detached instance of a particular class.


i got this answer to the same issue.
http://forum.hibernate.org/viewtopic.php?t=949807
my solution in that post was not feasible as i thought.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 15, 2005 6:31 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Patch welcome and fairly easy in this area.

_________________
Emmanuel


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