[jboss-user] [JBoss Seam] - Re: dynamic filtering of resultlists

ellenzhao do-not-reply at jboss.com
Tue Jul 17 10:22:55 EDT 2007


I would take this approach:

make a collection of lectures in the semester entity like this:


  | @Entity
  | @Name("semester")
  | ...
  | public class Semester implements Serializable{
  | ...
  | 
  | //I assume the semester and lecture is n:n so needing a linking entity called
  | // SemesterXLecture
  | private Set<SemesterXLecture> lectures;
  | 
  | @OneToMany    // lazy or eager as you wish, I would prefer eager here 
  | ...
  | public Set<SemesterXLecture> getLectures(){
  |   return this.lectures;
  | }
  | }
  | 

Then, in one of your conversation beans, load all Semesters and cache them. Then, you can use 


  | aSemester.getLectures();
  | 

anywhere in your conversation beans. You can also hood a semester in your xhtml file and use it similar to this code: 


  | <h:dataTable value="#{someManager.semester.lectures}" var="lecture">
  | <h:column>
  | <h:outputText value="#{lecture.desc}" />
  | </h:column>
  | ...
  | </h:dataTable>
  | 

so the lecture changes "dynamically" if you change the semester.


Regards,
Ellen

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4065025#4065025

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4065025



More information about the jboss-user mailing list