mercredi 1 juillet 2015

Querying CLOB column with hibernate criteria

I have a table like

Table Name: ITEMS
Columns :
Name          Type
ID            Number
Status        varchar2
data          clob

I have the hibernate mapping like below

@Entity
@Table(name="ITEMS",
uniqueConstraints = {@UniqueConstraint(columnNames={"id"})})
public class HItem implements Serializable {
    private long id;
    private String status;
    private String dataJSON;

    @Column(name = "ID")
    public long getId() {
        return id;
    }
    @Column(name = "status")
    public String getStatus() {
        return status;
    }
   @Column(name = "data")
    public String getDataJSON() {
        return dataJSON;
    }
}

and I am querying the data using criteria as follows

List<HItem> items = helper.getSession().createCriteria(HItem.class)
                .add(Restrictions.eq("status", "A")).list();

Since I have more than 1200 matching records in the table, this is throwing JDBC batch update error. I suspect due to large number of CLOB data this is getting caused.

Can you please help me how I can effectively fetch CLOB data through criteria?

Aucun commentaire:

Enregistrer un commentaire