Wednesday, 20 April 2016

What are the different fetching strategy in Hibernate ?


Hibernate3 defines the following fetching strategies : 

Join fetching
Hibernate retrieves the associated instance or collection in the same SELECT, using an OUTER JOIN.

Select fetching
A second SELECT is used to retrieve the associated entity or collection.
Unless you explicitly disable lazy fetching by specifying lazy="false", this second select will only be executed when you actually access the association.

Subselect fetching
A second SELECT is used to retrieve the associated collections for all entities retrieved in a previous query or fetch.
Unless you explicitly disable lazy fetching by specifying lazy="false", this second select will only be executed when you actually access the association.

Batch fetching
An optimization strategy for select fetching.
Hibernate retrieves a batch of entity instances or collections in a single SELECT, by specifying a list of primary keys or foreign keys.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.