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

import javax.persistence.Embeddable;
import java.io.Serializable;

/**
 * comment
 *
 * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
 */
@Embeddable
public class CompositePK implements Serializable
{
   private long id1;
   private long id2;

   public CompositePK()
   {
   }

   public CompositePK(long id1, long id2)
   {
      this.id1 = id1;
      this.id2 = id2;
   }

   public long getId1()
   {
      return id1;
   }

   public void setId1(long id1)
   {
      this.id1 = id1;
   }

   public long getId2()
   {
      return id2;
   }

   public void setId2(long id2)
   {
      this.id2 = id2;
   }

   public boolean equals(Object o)
   {
      if (this == o) return true;
      if (!(o instanceof CompositePK)) return false;

      final CompositePK compositePK = (CompositePK) o;

      if (id1 != compositePK.id1) return false;
      if (id2 != compositePK.id2) return false;

      return true;
   }

   public int hashCode()
   {
      int result;
      result = (int) (id1 ^ (id1 >>> 32));
      result = 29 * result + (int) (id2 ^ (id2 >>> 32));
      return result;
   }


}
