-->
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.  [ 1 post ] 
Author Message
 Post subject: generic prefetching
PostPosted: Tue Jun 21, 2005 12:27 pm 
Newbie

Joined: Thu Dec 16, 2004 12:27 pm
Posts: 7
Location: Long Island
Hibernate version:

3.0.5

I know that you can configure your mapping files with eager fetching, subselect fetching, batching, etc., and you can also use join fetching in HQL queries or equivalent in the Criteria API, but is there any way to prefetch relationships on a specific set of objects without refetching the source objects, or modifying the mappings? What I am aiming at is a utility that can be used from my application layer to generically specify to my data access layer what will be needed in a particular display.

For example, (using CaveatEmptor model)

Lets say I'm building a web application and one of the pages gets setup with a set of Items and displays them. Lets say that this particular display (however inefficient) needs to show for each item:

bids.user.*, bids.user.address.* (* meaning all non association properties)

I'd like to have something like the following implemented in the data access layer:

prefetcher.prefetchKeyPaths(items, new String[] {"bids.user", "bids.user.address"})

that can then be used to direct the data access to do whatever it can to fetch those relationships as efficiently as possible so they may be used in a display, without persistence layer code leaking into the application layer.

I'm actually coming from Apple's EOF, where I was able to build such a utility over what would translate in Hibernate to something like Hibernate.initialize(Object persistentObject) and Hibernate.initialize(Collection sourceObjects, String associationName). The first exists, but the second does not.

If anyone has any suggestions on how to accomplish this, that would be great. My implementation from EOF would actually port right over if I just had some way of batch intializing an association on a set of source objects(Hibernate.initialize(Collection sourceObjects, String associationName)

Thanks in advance,
-lenny


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

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.