/* * Hibernate, Relational Persistence for Idiomatic Java * * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ package org.hibernate.test.bytecode.enhancement.association; import java.util.HashSet; import java.util.Set; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.ManyToMany; import javax.persistence.OneToOne; /** * @author <a href="mailto:stale.pedersen@jboss.org">Ståle W. Pedersen</a> */ @Entity public class User { @Id private int id; private String login; private String password; @OneToOne(mappedBy = "user") private Customer customer; @ManyToMany private Set<Group> groups; public User() { } public Customer getCustomer() { return customer; } public void setCustomer(Customer customer) { this.customer = customer; } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public void addGroup(Group group) { Set<Group> groups = ( this.groups == null ? new HashSet<Group>() : this.groups ); groups.add( group ); this.groups = groups; } public Set<Group> getGroups() { return groups; } public void setGroups(Set<Group> groups) { this.groups = groups; } }