001    package biz.wedoit4u.databeans;
002    
003    import java.io.Serializable;
004    
005    /**
006     * A <code>primary key</code> class for the <code>partner_styles
007     * </code> table.  This class represents the composite
008     * <code>primary key</code> comprised of the <code>style_class_id</code>
009     * and <code>partner_Id</code> columns in the table.
010     *
011     * @author Rakesh Vidyadharan 03<sup><small>rd</small></sup> March 2004
012     *
013     * <p>Copyright 2004, wedoit4u.biz</p>
014     *
015     * @version $Id: PartnerStylesPK.java,v 1.2 2004/05/26 11:42:32 rakesh Exp $
016     */
017    public class PartnerStylesPK implements Serializable
018    {
019      /**
020       * The <code>style_class_id</code> value.
021       */
022      public int styleClassId;
023    
024      /**
025       * The <code>partner_id</code> value.
026       */
027      public int partnerId;
028    
029      /**
030       * Default constructor.  Nothing special needs to be done.
031       */
032      public PartnerStylesPK() {}
033    
034      /**
035       * Construct a new instance of the primary key class using the
036       * components of the primary key.
037       *
038       * @param styleClassId - The foreign key value to use.
039       * @param partnerId - The foreign key value to use.
040       */
041      public PartnerStylesPK( int styleClassId, int partnerId )
042      {
043        this.styleClassId = styleClassId;
044        this.partnerId = partnerId;
045      }
046    
047      /**
048       * Over-ridden form of the equals method.  This method is used by the
049       * EJB container to compare two instances of the primary key class
050       * to determine if two cached entity bean instances represent the
051       * same database data.
052       *
053       * @param obj - The primary key class to compare this class to.
054       * @return boolean - Returns <code>true</code> if the classes are
055       *   identical, and have the same fields.
056       */
057      public boolean equals( Object obj )
058      {
059        if ( this.getClass().equals( obj.getClass() ) )
060        {
061          PartnerStylesPK that = (PartnerStylesPK) obj;
062          return ( ( this.styleClassId == that.styleClassId ) && ( this.partnerId == that.partnerId ) );
063        }
064    
065        return false;
066      }
067    
068      /**
069       * Over-ridden form of the hashCode method.  Return a String object 
070       * that is obtained by contatenating the {@link #styleClassId} 
071       * and {@link #partnerId} variables with a <code>+</code> separating 
072       * them.
073       */
074      public String toString()
075      {
076        return ( styleClassId + "+" + partnerId );
077      }
078    
079      /**
080       * Over-ridden form of the hashCode method.  This method is used by
081       * the EJB container to look up the cached instances of the associated
082       * entity beans.  Return the <code>hashCode</code> of a  String 
083       * object that is obtained by contatenating the {@link #styleClassId} 
084       * and {@link #partnerId} variables with a <code>+</code> separating 
085       * them.
086       */
087      public int hashCode()
088      {
089        return toString().hashCode();
090      }
091    }