Results 1 to 2 of 2

Thread: Views filtering with Spring-Hibernate

  1. #1
    Join Date
    Feb 2009
    Posts
    5

    Default Views filtering with Spring-Hibernate

    Hello I have view in my db (MySql) .
    I want to get a filtered list of myView by specified userId as shown below


    Code:
    	         
    PersistenceLayer persistenceLayer = PersistenceLayer.getPersistenceLayer();
    MyViewDAO myView = persistenceLayer.getMyViewDAO();
    MyViewId myViewId = new MyViewId();
    myViewId.setUserId("11");
    MyView myView= new MyView();
    MyView.setId(myViewId);
    List<MyView> userlist = myView.findByExample(myView);
    But I get the full list.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    I suggest the hibernate reference guide? Find by example only works for simply properties, not objects. Your id which contains the userId is another object and nog a string/int/long etc... Hence it is not going to work (all of this is explained in the hibernate reference guide)
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •