Results 1 to 2 of 2

Thread: How to change this function to return list base on username col

  1. #1
    Join Date
    Mar 2011
    Posts
    166

    Default How to change this function to return list base on username col

    I had the following code sample that returns a list of friends from my database use Hibernate and it works get but I know change the function to pass in String which is the user. How can I change the following code to return all friends that username match the String i pass in?
    Code:
        public List<Friend> listFriends() 
        {
            return (List<Friend>) sessionFactory.getCurrentSession()
            .createCriteria(Friend.class).list();
        }

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

    Default

    I suggest a read of the hibernate reference guide and googling a tutorial... You want to find something on criteria queries.
    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

Tags for this Thread

Posting Permissions

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