I found the problem. I had to specify the fieldbridge type to LongBridge.class.
The only problem now is that the content of the file doesnt get indexed or searched. The title which is a string does though.
here is the code for the object:
package com.agader.struts.actions.beansAnnotated;
import java.sql.Blob;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import org.hibernate.Hibernate;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FieldBridge;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Store;
import org.hibernate.search.bridge.builtin.LongBridge;
@Entity
@Indexed()
public class Documento implements java.io.Serializable {
@Id
@DocumentId
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@Column(name = "titulo", nullable = false)
@Field(index=Index.TOKENIZED, store=Store.NO)
private String titulo;
@Lob
@Column(name = "contenido", nullable = false)
@FieldBridge(impl=LongBridge.class)
@Field(index=Index.TOKENIZED, store=Store.NO)
private Blob contenido;
@ManyToOne()
@JoinColumn(name="ape_id", nullable=false, insertable=false, updatable=false)
private Ape ape;
public Documento() {
}
public Documento(String titulo) {
this.titulo=titulo;
}
public Long getId() {
return id;
}
public void setId(Long id) {
id = id;
}
public String getTitulo() {
return titulo;
}
public void setTitulo(String leapingHeight) {
titulo = leapingHeight;
}
public Ape getApe() {
return ape;
}
public void setApe(Ape ape) {
this.ape = ape;
}
public Blob getContenido() {
return contenido;
}
public void setContenido(Blob contenido) {
this.contenido = contenido;
}
}
|