/*
 * JBoss, the OpenSource J2EE webOS
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.ejb3.test.regression;

import javax.persistence.JoinColumn;
import javax.persistence.CascadeType;
import javax.persistence.OneToMany;
import javax.persistence.GeneratorType;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Collection;
import java.util.ArrayList;

/**
 * comment
 *
 * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
 */
@Entity
@Table(name="account")
public class Account implements Serializable
{
   private long id;
   private Collection<AccountName> names = new ArrayList<AccountName>();

   @Id(generate = GeneratorType.IDENTITY)
   public long getId()
   {
      return id;
   }

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

   @OneToMany(mappedBy = "account", cascade = CascadeType.ALL, fetch=FetchType.EAGER)
   @JoinColumn(name = "accountId")
   public Collection<AccountName> getNames()
   {
      return names;
   }

   public void setNames(Collection<AccountName> names)
   {
      this.names = names;
   }
}
