/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.test.event.collection.detached;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
@Entity
public class MultipleCollectionRefEntity1 implements org.hibernate.test.event.collection.Entity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID", length = 10)
private Long id;
@Column(name = "TEXT", length = 50, nullable = false)
private String text;
@ManyToOne
@JoinColumn(name = "MCE_ID", nullable = false, insertable = false, updatable = false)
@org.hibernate.annotations.ForeignKey(name = "FK_RE1_MCE")
private MultipleCollectionEntity multipleCollectionEntity;
@Column(name = "MCE_ID", insertable = false, updatable = false)
private Long multipleCollectionEntityId;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public MultipleCollectionEntity getMultipleCollectionEntity() {
return multipleCollectionEntity;
}
public void setMultipleCollectionEntity(
MultipleCollectionEntity multipleCollectionEntity) {
this.multipleCollectionEntity = multipleCollectionEntity;
}
public Long getMultipleCollectionEntityId() {
return multipleCollectionEntityId;
}
public void setMultipleCollectionEntityId(Long multipleCollectionEntityId) {
this.multipleCollectionEntityId = multipleCollectionEntityId;
}
@Override
public String toString() {
return "MultipleCollectionRefEntity1 [id=" + id + ", text=" + text
+ ", multipleCollectionEntityId=" + multipleCollectionEntityId
+ "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((text == null) ? 0 : text.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;
MultipleCollectionRefEntity1 other = (MultipleCollectionRefEntity1) obj;
if (text == null) {
if (other.text != null)
return false;
} else if (!text.equals(other.text))
return false;
return true;
}
public MultipleCollectionRefEntity1 deepCopy(MultipleCollectionEntity newRef) {
MultipleCollectionRefEntity1 clone = new MultipleCollectionRefEntity1();
clone.setText(this.text);
clone.setId(this.id);
clone.setMultipleCollectionEntity(newRef);
clone.setMultipleCollectionEntityId(newRef.getId());
return clone;
}
}