FileDocCategorySizeDatePackage
User.javaAPI DocHibernate 3.2.5764Wed Apr 11 09:25:14 BST 2007org.hibernate.test.insertordering

User.java

package org.hibernate.test.insertordering;

import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;

/**
 * {@inheritDoc}
 *
 * @author Steve Ebersole
 */
public class User {
	private Long id;
	private String username;
	private Set memberships = new HashSet();

	/**
	 * for persistence
	 */
	User() {
	}

	public User(String username) {
		this.username = username;
	}

	public Long getId() {
		return id;
	}

	public String getUsername() {
		return username;
	}

	public Iterator getMemberships() {
		return memberships.iterator();
	}

	public Membership addMembership(Group group) {
		Membership membership = new Membership( this, group );
		memberships.add( membership );
		return membership;
	}
}