-->
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: Parametric load on demand
PostPosted: Wed Feb 04, 2009 5:39 am 
Newbie

Joined: Wed Feb 04, 2009 5:26 am
Posts: 5
Hi,

My problem may be a new idea, but here's what I'd like to do.
Is there any way to do some "parametric load on demand".

In fact, I'd like to annotate some fields (that can be huge) with something like

public class Example {
@LoadWhen(param=[1,2])
private Object field1;

@LoadWhen(param=[1])
private Object field2;

@LoadWhen(param=[2])
private Object field3;
...
}

And when I want to get the Example classes :
** A call to session.createQuery("from Example",[1,2]) will load every Example Object fetching only 'field1'
** A call to session.createQuery("from Example",[1]) will load every Example Object fetching only 'field1' and 'field2'
** A call to session.createQuery("from Example",[2]) will load every Example Object fetching only 'field1' and 'field3'

I think it's the best way to manage on demand loading. If you know a better or existing way to do the same, thanks in advance.

JL.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2009 5:58 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
You could use lazy-property-fetching instead and in your queries select the properties you want to be selected.

_________________
-----------------
Need advanced help? http://www.viada.eu


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.