Announcement Announcement Module
Collapse
No announcement yet.
How to change this function to return list base on username col Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment

    Working...
    X