/*
* Hibernate Search, full-text search for your domain model
*
* 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.search.test.embedded.update;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
@Entity
@Indexed
public class Son {
private Long id;
private String name;
private Dad dad;
public Son() {
}
public Son(String name) {
this.name = name;
}
@Id
@GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Field(analyze = Analyze.NO)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@IndexedEmbedded
@ManyToOne
public Dad getDad() {
return dad;
}
public void setDad(Dad dad) {
this.dad = dad;
}
@Override
public boolean equals(Object o) {
if ( this == o ) {
return true;
}
if ( !( o instanceof Son ) ) {
return false;
}
Son son = (Son) o;
return name.equals( son.getName() );
}
@Override
public int hashCode() {
return name.hashCode();
}
}