Java Reference
In-Depth Information
return sections;
}
public void setSections(List<Section> sections) {
this.sections = sections;
}
public void addSection(Section section) {
this.getSections().add(section);
section.setEdition(this);
}
@Id
@GeneratedValue
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getEdition() {
return edition;
}
public void setEdition(String edition) {
this.edition = edition;
}
public void removeSection(Section section) {
this.getSections().remove(section);
}
}
The Section entity class
The
Section
entity has properties
id
and
sectionName
:
private String id;
private String sectionName;
The
Section
entity defines
NamedQueries
findSectionAll
, which finds all the
Section entities, and
findSectionBySectionName
, which finds a
Section
entity by
section name:
@NamedQueries({
@NamedQuery(name="findSectionAll", query="SELECT s FROM Section s"),
@NamedQuery(name="findSectionBySectionName",
query="SELECT s from Section s WHERE s.sectionName = :section")
})
Search WWH ::
Custom Search