Hi,
I have a two classes / tables, whereby the first class
Code:
@Entity( name = "report" )
public class Report
holds a list of objects from the second class:
Code:
@OneToMany(mappedBy="report", fetch=FetchType.EAGER)
@Cascade({org.hibernate.annotations.CascadeType.ALL,
org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
@org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
private List<ReportRow> rows = new ArrayList<ReportRow>();
The second class
Code:
@Entity( name = "report_row" )
public class ReportRow
has an attribute for the report:
Code:
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="report_row_report_id",nullable=false)
private Report report;
and another one: reportRowDeleted, which indicates if the row is deleted or not:
Code:
@Column(name = "report_deleted")
private Boolean reportRowDeleted;
Currently I'm reading all ReportRows belonging to a specific report in my ReportDao with a DetachedCriteria:
Code:
DetachedCriteria criteria = DetachedCriteria.forClass(Report.class).add(Property.forName("reportName").eq(reportName));
ArrayList<Report> list = (ArrayList<Report>)getHibernateTemplate().findByCriteria(criteria);
Now I want to read only those rows, which are not deleted. I tried to find out how to do this by studiying the documentation, but I wasn't succesfull. Could you please help me with this?
As you can see I'm using Spring in combination with Hibernate.
Any help would be appreciated. Thanks in advance.