Solution:
CourseHandler:
| public List<Course> getCoursesForInstructor(CmtUser instructor){
| try{
| Query q = em.createQuery(
| "SELECT c FROM Course c" +
| " WHERE c.instructor = :instructor");
| q.setParameter("instructor",instructor);
|
| List<Course> courses = (List<Course>) q.getResultList();
| return courses ;
|
| }
|
| catch(EntityNotFoundException ex){
| System.out.println("FEHLER!!!!"+ex);
| }
| return null;
| }
Course:
@Entity
| public class Course implements Serializable{
| @Id
| @GeneratedValue(strategy = GenerationType.AUTO)
| private Long id;
|
| private String title;
| private String abbreviation;
| private String description;
| private String semester;
| @Column(columnDefinition="BOOL")
| private boolean active = false;
|
| //unidirektional
| @ManyToOne
| @JoinColumn(name="instructor")
| private CmtUser instructor;
| ...
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4198448#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...