I have the following class :
public class Section {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "ID")
private Long id;
...
@ManyToOne
@JoinColumn(name = "SECTION_ID")
private Section section; // need this write only
@OneToMany
private List<Section> sectionList;
}
I want to retrieve the section list when reading the section, but I don't want to get the section. is that possible ? I can't use @Transient because I need the section to be persisted.
Note: I will use findAll from spring repository so I will not use native query.