package com.github.cstroe.spendhawk.entity;

import com.github.cstroe.spendhawk.util.HibernateUtil;
import org.hibernate.criterion.Restrictions;

import java.util.Collection;

/**
 * A user has many accounts.
 */
public class User {
    private Long id;
    private String name;
    private Collection<Account> accounts;
    private Collection<Category> categories;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Collection<Account> getAccounts() {
        return accounts;
    }

    public void setAccounts(Collection<Account> accounts) {
        this.accounts = accounts;
    }

    public Collection<Category> getCategories() {
        return categories;
    }

    public void setCategories(Collection<Category> categories) {
        this.categories = categories;
    }

    public static User findById(Long id) {
        return (User) HibernateUtil.getSessionFactory().getCurrentSession()
                .createCriteria(User.class)
                .add(Restrictions.eq("id", id))
                .uniqueResult();
    }

}

@@ -190,23 +190,205 @@
  has
- many accounts.
+:%0A * %3Cul%3E%0A *     %3Cli%3EA unique database id.%3C/li%3E%0A *     %3Cli%3EA user name.  Used for identification in the system.%3C/li%3E%0A *     %3Cli%3EMany accounts.%3C/li%3E%0A *     %3Cli%3EMany expense categories.%3C/li%3E%0A * %3C/ul%3E
 %0A */

Update description on User entity.