Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8419569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:39:01+00:00 2026-06-10T02:39:01+00:00

Can someone explain me why using the annotation @Fetch(FetchMode.SELECT) allows me to use Lists

  • 0

Can someone explain me why using the annotation @Fetch(FetchMode.SELECT) allows me to use Lists instead of Sets? Which is the difference by using other fetchmode types like SUBSELECT?

Here below a piece of exmple code:

class One{
   ..
   @Fetch(FetchMode.SELECT)
   @OneToMany(mappedBy="one", fetch = FetchType.EAGER, ... )
   private List<Something> listOne = new ArrayList<Something>();

   @Fetch(FetchMode.SELECT)
   @OneToMany(mappedBy="one", fetch = FetchType.EAGER, ... )
   private List<SomethingElse> listTwo = new ArrayList<SomethingElse>();
   ...
}

In this way it works but I’d like to know why….I found other discussion with alternatives solutions but this one wasn’t the preferred one…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:39:02+00:00Added an answer on June 10, 2026 at 2:39 am

    You should be able to use List or Set as the interface for your collection, it has nothing to do with fetching.

    @Fetch(FetchMode.SELECT) together with fetch = FetchType.EAGER means that after loading the One entity hibernate will immediately issue a second select to load list.

    The @Fetch(FetchMode.SUBSELECT) without fetch = FetchType.EAGER means that hibernate will load the list with a subselect for all one enitities (they might also be part of a collection) when accessing the first list element(List<SomethingElse>).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone explain the difference between using a $ when defining variables in jQuery
Can someone explain the difference between using define('SOMETHING', true); and $SOMETHING = true; And
Can someone explain to me if I should use bcpow() instead of pow() and
when using hibernate with spring, can someone explain how the session unit of work
I'm looking into hash and salting passwords using bcrypt in PHP. Can someone explain
Can someone please explain this phenomenon? I am using Mojarra 2.1.6 - Glassfish 3.1.2.
I'm new to liquibase (I'm using Spring Liquibase )... Can someone please explain whether
I would like to access a MySQL database using PHP. Can someone please explain
Can someone explain me why this works: select val1, val2, count(case when table2.someID in
Can someone explain step by step how this query is processed? SELECT F.ID, F.FirstName,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.