parentpk.java

来自「hibernate方便的操作数据库相当不错的 请各位下载看看啊」· Java 代码 · 共 38 行

JAVA
38
字号
//$Id: ParentPk.java,v 1.3 2004/12/01 00:24:08 epbernard Exp $package org.hibernate.test.metadata.manytoone;import javax.ejb.DependentObject;import javax.ejb.AccessType;import java.io.Serializable;/** * @author Emmanuel Bernard */@DependentObject(access = AccessType.FIELD)public class ParentPk implements Serializable {	String firstName;	String lastName;	/** is a male or a female */	//show hetereogenous PK types	boolean isMale;	public int hashCode() {		//this implem sucks		return firstName.hashCode() + lastName.hashCode() + (isMale?0:1);	}	public boolean equals(Object obj) {		//firstName and lastName are expected to be set in this implem		if (obj != null && obj instanceof ParentPk) {			ParentPk other = (ParentPk) obj;			return firstName.equals(other.firstName)					&& lastName.equals(other.lastName)					&& isMale == other.isMale;		}		else {			return false;		}	}}

⌨️ 快捷键说明

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