@ 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?