reset password
Author Message
hgadhia
Posts: 52
Posted 00:15 Mar 11, 2015 |

I have seen in CSNS, we use "left join fetch user.roles" to fetch the roles eagerly. How can we extend this fetch more columns eagerly?

My Plan class has list of stages, runways and checkpoints, all of which I want to fetch eagerly. How can I do this?

Writing fetch = FetchType.EAGER on each gives the following exception, 

org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags

cysun
Posts: 2935
Posted 12:58 Mar 11, 2015 |

Lazy loading is usually better for performance so don't use eager loading unless you know what you are doing. If you do want to eager load all those collections, read this.