package cn.com.qmth.stmms.biz.exam.model;

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

@Embeddable
public class MarkGroupStudentPK implements Serializable {

    private static final long serialVersionUID = 5274946877418574003L;

    @Column(name = "student_id", nullable = false)
    private Integer studentId;

    @Column(name = "group_number", nullable = false)
    private Integer groupNumber;

    public Integer getStudentId() {
        return studentId;
    }

    public void setStudentId(Integer studentId) {
        this.studentId = studentId;
    }

    public Integer getGroupNumber() {
        return groupNumber;
    }

    public void setGroupNumber(Integer groupNumber) {
        this.groupNumber = groupNumber;
    }

    @Override
    public int hashCode() {
        final int PRIME = 31;
        int result = 1;
        result = PRIME * result + ((studentId == null) ? 0 : studentId.hashCode());
        result = PRIME * result + ((groupNumber == null) ? 0 : groupNumber.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        final MarkGroupStudentPK other = (MarkGroupStudentPK) obj;
        if (studentId == null) {
            if (other.studentId != null)
                return false;
        } else if (!studentId.equals(other.studentId))
            return false;
        if (groupNumber == null) {
            if (other.groupNumber != null)
                return false;
        } else if (!groupNumber.equals(other.groupNumber))
            return false;
        return true;
    }

}
