I have a problem querying an entity with a lob property, thats my entity's definition :
Code:
@Entity
public class File{
@Id @GeneratedValue(strategy=GenerationType.AUTO)
long code ;
@ManyToOne
Person person = null;
Date timestamp = Calendar.getInstance().getTime();
String fileName = "";
@OneToOne
User creator = null;
@OneToOne
User lastUpdater = null;
String description = "";
@Lob @Basic(fetch = FetchType.LAZY)
Blob contents = null;
...geters/setters
}
and that's the way a query the objects :
Code:
List<File> results =entityManager.createQuery(" from File f").getResultList();
entityManager is injected from the seam's context.
I'm using mysql with mysql inno dialect, the query is very very slow and very memory consuming cause hibernate includes the lob field into the sql.
What am i not doing in the right way?
thanks.