-->
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.  [ 1 post ] 
Author Message
 Post subject: HELP!!! Bag sorting problem.
PostPosted: Thu Aug 19, 2010 12:25 pm 
Newbie

Joined: Mon Aug 02, 2010 11:14 pm
Posts: 10
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.


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

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.