-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Criteria question
PostPosted: Thu Feb 05, 2009 11:54 am 
Newbie

Joined: Sun Feb 01, 2009 12:39 pm
Posts: 5
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.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 06, 2009 2:08 am 
Newbie

Joined: Sun Feb 01, 2009 12:39 pm
Posts: 5
Nobody?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.