Spring-HIbernate无法弄清楚查询

时间:2011-08-08 22:38:52

标签: hibernate spring-mvc

db中有三个类..人物(ID,FNAME,LNAME),事件(ID,NAME,DATE),注册(ID,P_ID,E_ID,REGDATE,NOTES)

我的实体课...... 人     @实体     公共课人{      @ID      private Integer id;

 @Column(name="FNAME")
 private String fName;

 @Id @Column(name="LNAME")
 private String lName;

 @OnetoMany(targetEntity=Registration.class, mappedBy="pId", cascade.....)
 private Set<Registrations> registrations;
  //getters and setters
}

活动

 @Entity 
 public class Events{
   @Id  
   private Integer id;

 @Column(name="NAME")
 private String name;

 @Id @Column(name="DATE")
 private Timestamp date;

 @OnetoMany(targetEntity=Registration.class, mappedBy="eId", cascade.....)
 private Set<Registrations> registrations;
  //getters and setters
}

我需要一个搜索表单,您可以在其中搜索fname或lname或参加过的活动。所以我创建了一个这样的类,用作命令对象......

 public class SearchForm{
    private String fName;
    private String lName;
    private Set<Event> events;
    //setters and getters
 }

search.jsp的                                    

0 个答案:

没有答案