studyid.java

来自「使用hibernate」· Java 代码 · 共 75 行

JAVA
75
字号
package com.hibernate.bean;



/**
 * StudyId generated by MyEclipse - Hibernate Tools
 */

public class StudyId  implements java.io.Serializable {


    // Fields    

     private Student student;
     private Course course;


    // Constructors

    /** default constructor */
    public StudyId() {
    }

    
    /** full constructor */
    public StudyId(Student student, Course course) {
        this.student = student;
        this.course = course;
    }

   
    // Property accessors

    public Student getStudent() {
        return this.student;
    }
    
    public void setStudent(Student student) {
        this.student = student;
    }

    public Course getCourse() {
        return this.course;
    }
    
    public void setCourse(Course course) {
        this.course = course;
    }
   



   public boolean equals(Object other) {
         if ( (this == other ) ) return true;
		 if ( (other == null ) ) return false;
		 if ( !(other instanceof StudyId) ) return false;
		 StudyId castOther = ( StudyId ) other; 
         
		 return ( (this.getStudent()==castOther.getStudent()) || ( this.getStudent()!=null && castOther.getStudent()!=null && this.getStudent().equals(castOther.getStudent()) ) ) && ( (this.getCourse()==castOther.getCourse()) || ( this.getCourse()!=null && castOther.getCourse()!=null && this.getCourse().equals(castOther.getCourse()) ) );
   }
   
   public int hashCode() {
         int result = 17;
         
         result = 37 * result + ( getStudent() == null ? 0 : this.getStudent().hashCode() );
         result = 37 * result + ( getCourse() == null ? 0 : this.getCourse().hashCode() );
         return result;
   }   





}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?