Example & Tutorial understanding programming in easy ways.

What are the various fetching strategies from the database in Hibernate?

Fetching Strategies: In the Hibernate we have few fetching strategies to optimize the Hibernate generated select statement, so that it can be as efficient as possible. The fetching strategy is declared in the mapping relationship to define how Hibernate fetch its related collections and entities.

There are four fetching strategies

1. fetch-”join” = Disable the lazy loading, always load all the collections and entities.

2. fetch-”select” (default) = Lazy load all the collections and entities.

3. batch-size=”N” = Fetching up to ‘N’ collections or entities, *Not record*.

4. fetch-”subselect” = Group its collection into a sub select statement.

Read More →
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!