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

📄 lotz.java

📁 Hibernate Annotations Sample
💻 JAVA
字号:
//$Id: Lotz.java 14736 2008-06-04 14:23:42Z hardy.ferentschik $package org.hibernate.test.annotations.manytoone;import java.util.List;import java.io.Serializable;import javax.persistence.Entity;import javax.persistence.EmbeddedId;import javax.persistence.Column;import javax.persistence.FetchType;import javax.persistence.OneToMany;import javax.persistence.CascadeType;/** * @author Emmanuel Bernard */@Entitypublic class Lotz implements Serializable {	@EmbeddedId	protected LotzPK lotPK;	@Column( name = "name", nullable = false )	private String name;	@Column( name = "location", nullable = false )	private String location;	@OneToMany( mappedBy = "lot", fetch = FetchType.LAZY, cascade = CascadeType.ALL )	private List<Carz> cars;	public Lotz() {	}	public List<Carz> getCars() {		return this.cars;	}	public void setCars(List<Carz> cars) {		this.cars = cars;	}	public String getLocation() {		return this.location;	}	public void setLocation(String location) {		this.location = location;	}	public LotzPK getLotPK() {		return this.lotPK;	}	public void setLotPK(LotzPK lotPK) {		this.lotPK = lotPK;	}	public String getName() {		return this.name;	}	public void setName(String name) {		this.name = name;	}	@Override	public int hashCode() {		final int PRIME = 31;		int result = 1;		result = PRIME * result + ( ( this.location == null ) ?				0 :				this.location.hashCode() );		result = PRIME * result + ( ( this.lotPK == null ) ?				0 :				this.lotPK.hashCode() );		result = PRIME * result + ( ( this.name == null ) ?				0 :				this.name.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 Lotz other = (Lotz) obj;		if ( this.location == null ) {			if ( other.location != null ) return false;		}		else if ( !this.location.equals( other.location ) ) return false;		if ( this.lotPK == null ) {			if ( other.lotPK != null ) return false;		}		else if ( !this.lotPK.equals( other.lotPK ) ) return false;		if ( this.name == null ) {			if ( other.name != null ) return false;		}		else if ( !this.name.equals( other.name ) ) return false;		return true;	}}

⌨️ 快捷键说明

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