Hey Guys,
I am extremely frustrated. I have a class called Students say it looks something like this.
Code:
public class students{
private List<Schedule> schedule;
private List<Watch> watches;
//works well, can't remember the correct syntax, but ignore syntax and take in the concept of the question. so this is a double join using a bridge table...that's where the problem really lies but I want a solution.
@JoinTable("student_schedule", @JoinColumn(name="std_std_id", referenced_Column="std_id"), inverseJoinColumn(name="sch_sch_id", referenced_column="sch_id"))}
@OnetoMany(cascade=CascadeAll)
public List<Schedule> getSchedule()
{
return schedule;
}
...
}
public class Schedule{
private Date startTime;
private String day;
...
}
public class Watch{
private String color;
}
Ok so now I want a scheduleLsit with day="monday" and watchList with color="blue".
Now using criteria isn't an option since multiple bags cannot be retrieved. However if you take a look at the queries being dished out to the database, for both of the lists there is a query something like this...
Code:
select from student_schedule join student on std_std_id = std_id where std_id = "the id of the student inside of which this bag resides..."
Code:
select from watch where std_std_id = "the id of the student inside of which this bag resides..."
So now, I can add filters...and that seems to append certain conditions, but when I try to order, that's when I run into issues. If I put the order by clause in the @filterdef stuff, then it gets added before the std_id = "..." part, but after the where.