Sripaul Sripaul - 1 year ago 178
Java Question

GenericJDBCException in HSQL

I have an entity called

. I am saving two records of type
. Both the two inserts succeed when run independently. I mean //alone works //alone works

but together running them as

HSQL throws a

@Table(name = "ProdTransaction")
public class ProdTransactionextends PersistentObject implements Serializable {
private static final long serialVersionUID = 1L;

private ProdTranPK id;

@Column(name = "REC_ID")
private Long recId;

private Date date1;

@Column(length = 1)
private String comment;

I have verified the data and it's all fine. When I run against HSQL I get:

GenericJDBCException: could not execute JDBC batch update.

But if I connect to my physical DB, and run with the same sequence, it works fine. What could be the problem in HSQL? I am using version 1.8.

Answer Source

HSQLDB batching bug was fixed, now it works ok. Problem is that if you have an error, such as a problem with your sql statement etc, you'll only get a generic exception that doesn't really tell you anything. What I like to do is have a helper class that can execute sql queris in batch mode and individually, and I switch to individual queris when I get weird errors from batch mode. Try that, maybe it's just a simple mistake in your SQL

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download