In hibernate (3.2.1.GA), I use the following method to insert CLOB type data into Oracle (10g) database.
Hibernate.createClob(parameters.get("txtCatImage"));
parameters
is a Map
where all the request parameters have been stored. While retrieving the Clob
data type from the database directly something like this entityObj.getCatImage()
would not work.
Seen this and this questions but couldn't find the way.
The following is the entity that uses a Clob
type property.
public class Category implements java.io.Serializable {
private Long catId; // Primary key.
private Clob catImage; // CLOB type field.
// Other fields.
private static final long serialVersionUID = 1L;
public Category() {}
// Overloaded constructs + getters + setters + hashcode() + equals() + toString().
}
The Clob
field in the database just stores an image file name, in this case.