/*
* Hibernate OGM, Domain model persistence for NoSQL datastores
*
* 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.ogm.backendtck.queries;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.DateBridge;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import org.hibernate.search.annotations.NumericField;
import org.hibernate.search.annotations.Resolution;
import org.hibernate.search.annotations.SortableField;
import org.hibernate.search.annotations.Store;
/**
* @author Emmanuel Bernard
*/
@Entity
@Indexed
public class Hypothesis {
private String id;
private String description;
private int position;
private Date date;
private Author author;
@Id
@SortableField
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@Field(analyze = Analyze.NO, store = Store.YES, indexNullAs = "#<NULL>#")
@SortableField
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Column(name = "pos")
@Field(analyze = Analyze.NO)
@NumericField
@SortableField
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
@Field(analyze = Analyze.NO)
@DateBridge(resolution = Resolution.DAY)
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
@OneToOne(cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
@IndexedEmbedded(indexNullAs = Field.DEFAULT_NULL_TOKEN)
public Author getAuthor() {
return author;
}
public void setAuthor(Author author) {
this.author = author;
}
@Override
public String toString() {
return "Hypothesis [id=" + id + ", description=" + description + ", position=" + position + ", date=" + date + "]";
}
}