-->
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.  [ 6 posts ] 
Author Message
 Post subject: Is Selective Retrieval NOT Supported In Hibernate ???
PostPosted: Thu Feb 26, 2004 6:58 am 
Beginner
Beginner

Joined: Tue Feb 17, 2004 7:53 am
Posts: 24
Hello ,

Please let me know if I can have selective retrieval of attributes. For example, if I have a Catalog table which contains say 20 columns. There is one column of type CLOB which contains heavy data.While loading catalogs I do not want to fetch the CLOB for performance reasons. DOES HIBERNATE PROVIDES THIS FUNCTIONALITY ?????

I read Hibernate referencve guide and it mentions of FetchGroup.LAZY
I tried using this for the CLOB column but it doesnt work for me. Can I have lazy loading of simple attributes (which are not collections/entities)

The mapping file and the code snippet is provided : PlSSS let me know if I am missing something ?

<class name="com.aceva.rms.knowledge.config.Catalog" table="Catalog">
<id name="id" column="catalog_id" type="long" unsaved-value="null">
<generator class="sequence"/>
</id>
<property name="definition" column="definition" type="clob"/>
<property name="name" column="name" type="string" length="30"/>
</class>

try{
session = HibernateUtils.currentSession();
Criteria criteria = session.createCriteria(Catalog.class)
.setFetchMode("definition", FetchMode.LAZY);
List list = criteria.list();
for (int i = 0; i < list.size(); i++)
{
Catalog catalog = (Catalog) list.get(i);
logMessage("Catalog Fetched!");
Clob clob = catalog.getDefinition();
logMessage("asked for definition! " + clob.getClass().getName());
}
}

Help is urgently required!!!

Thanks in advance

Anjali


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 9:42 am 
Newbie

Joined: Wed Sep 24, 2003 7:37 am
Posts: 6
Location: Bologna (ITALY)
Maybe that you can use a lightweight and an heavyweight object with explicit polymorphism.

[url]http://www.hibernate.org/41.html [/url]

Mauro.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 9:44 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
or projection

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 9:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Clobs are lazy by definition! If your JDBC driver implements Clob support correctly, you should /not/ need to do anything special.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 27, 2004 12:49 am 
Beginner
Beginner

Joined: Tue Feb 17, 2004 7:53 am
Posts: 24
Thanks Everybody for the help ..

Yeah I went through the link which tells about the LightWeightPattern and I have implemented that and it worked for me. But this is not feasible
to implement in my current system at certain places
Q.1) I guess Hibernate must be providing some way to specify that these columns/atttributes should be lazily fteched . Either the user can specify it in configuration mapping file or like.. I guess JDO supports this Lazy fetching through mapping file.

Q.2) I read about FetchMode . Its provides diff fetch modes like LAZY, DEFAULT, EAGER. Are these not related to this ? Will they work only with associations ?? Not very clear on the usage of this.

Q.3) Can you quote me an example or any reference how projection can help me ? Are you talking about writing queries like select doc_id, doc_name, acc_no from document table (where document table has say 20 columns)
So in this case Hibernate is not providing me anything except the Pattern mentioned . Because for reporting and bulk load , this is a very important requirement and we need this greatly :-)

Hoping to get a reply soon

Thanks
Anjali


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 01, 2004 11:57 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
anjali wrote:
Q.1) I guess Hibernate must be providing some way to specify that these columns/atttributes should be lazily fteched .

We don't really agree with that. loading a property is not really an overload except for huge amount of binary or txt in a field.
It was long discussed and we're quite happy with the previous workarounds.

anjali wrote:
Q.3) Can you quote me an example or any reference how projection can help me ? Are you talking about writing queries like select doc_id, doc_name, acc_no from document table (where document table has say 20 columns)

Yes this is what projection is.

_________________
Emmanuel


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