0

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?

1
  • if data is clob type, you should annotate @Lob to dataJSON. Commented Jul 2, 2015 at 6:56

1 Answer 1

1

Please try to use the @Lob annotation. See here :

Lob

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.