db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg von Frantzius <joerg.von.frantz...@artnology.com>
Subject Re: Fetch groups and EJB3
Date Mon, 08 Aug 2005 12:48:29 GMT
Niclas Hedhman schrieb:

>On Monday 08 August 2005 17:48, Jörg von Frantzius wrote:
>  
>
>>concept of fetch groups
>>    
>>
>
>Do you have some definition for what the meaning of "fetch groups" are for us 
>who have no clue ???
>  
>
It's part of the JDO specification, and it allows you to statically 
declare groups of fields on classes and then dynamically combine these 
groups to specify which fields of a class you want to have fetched from 
the DB when using a Query or retrieving via a PersistenceManager directly.
 
You can e.g. chose the predefined FetchPlan.EMPTY on a Query to have 
"shallow" objects, which will effectively only retrieve the ids. Any 
access on non-loaded fields will transparently result in lazy-loading of 
the values.

If e.g. in a GUI table you show only a subset of the fields of a class, 
and you otherwise don't need the values of the fields not displayed, you 
could define a fetch group "guiTable" that includes only those fields. 
Saves you both a little loading time and memory.

While the default fetch group only includes primitive values, you can 
define a fetch group that includes complex fields, i.e. associations. In 
EJB3, you explicitly have to query using a JOIN condition to achieve the 
same. Personally, I don't care how my association is retrieved, so I 
prefer to just say what I want to have retrieved and not how.

Also, it allows you to control what fields are loaded when you detach an 
object graph.

>
>Cheers
>Niclas
>
>
>  
>


-- 
__________________________________________________________
Dipl.-Inf. Jörg von Frantzius  |            artnology GmbH
                               |                Milastr. 4
Tel +49 (0)30 4435 099 26      |              10437 Berlin
Fax +49 (0)30 4435 099 99      |  http://www.artnology.com
_______________________________|__________________________


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message