⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parentpk.java

📁 hibernate3.2.6源码和jar包
💻 JAVA
字号:
//$Id: ParentPk.java 11282 2007-03-14 22:05:59Z epbernard $package org.hibernate.test.annotations.onetomany;import java.io.Serializable;import javax.persistence.Embeddable;/** * @author Emmanuel Bernard */@Embeddablepublic 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -