How do associated annotations such as @ OneToMany specify the fields to be queried?

How do associated annotations such as

@ OneToMany, @ OneToOne, @ ManyToMany, etc., specify the fields to be queried?

for example, the following code

@Entity
@Table(name = "db_user")
public class User{
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    private String name;
    
    @JoinColumn(name="userId")
    @OneToMany()
    private List<Child> childs;
    
    //get set
}

@Entity
@Table(name = "db_Child")
public class Child{
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    private String name;
    
    private Integer age;
    
    @Column(name="user_id")
    private Integer userId;
    
    //get set
}

query User will be associated with query childs. In this case, both name and age of childs have values. Is there anything I can do if I only want to query name?

Apr.09,2022

is not supported by default, but you can add bytecode enhancement, and once set, the private byte [] type can be lazy load. If you have to consider the performance of fetching a few more fields, you should write your own sql to fetch data instead of using the or mapping framework.

Menu