Kim Hansen
2010-02-02 12:12:37 UTC
When I do this:
mergeStmt = connection.prepareStatement("" //
+ "MERGE INTO data USING (VALUES(?, ?, ?, ?, ?, ?,
?, ?))" //
+ " AS vals (vid, vkey_, vtype_, vno_, vdouble_,
vstring_, vboolean_, vtimestamp_)" //
+ " ON (id, key_) = (vid, vkey_)" //
+ " WHEN MATCHED THEN UPDATE SET type_=vtype_,
no_=vno_, double_=vdouble_," //
+ " string_=vstring_, boolean_=vboolean_,
timestamp_=vtimestamp_" //
+ " WHEN NOT MATCHED THEN INSERT" //
+ " VALUES (vid, vkey_, vtype_, vno_, vdouble_,
vstring_, vboolean_, vtimestamp_)");
I get this:
[junit] Caused by: java.sql.SQLException: data type cast needed
for parameter or null literal
[junit] at org.hsqldb.jdbc.Util.sqlException(Util.java:208)
[junit] at
org.hsqldb.jdbc.JDBCPreparedStatement.<init>(JDBCPreparedStatement.java:3882)
[junit] at
org.hsqldb.jdbc.JDBCConnection.prepareStatement(JDBCConnection.java:637)
[junit] at org.stowbase.aperitivo.db.hsql.HsqlMap.<init>(HsqlMap.java:49)
Am I doing something wrong or is it a bug in HSQLDB? I am using
2.0.0-rc8 compiled for Java 1.5 based on a svn snakshop (Rev 3443).
My goal is to do Update/Insert faster than delete followed by an
insert (I have profiled my application and 80% of its time is spend on
doing that), what is the fastest way to do that in hsqldb (I usually
have 5-10 values to "upsert", and most of the time it will be an
insert)?
Regards,
mergeStmt = connection.prepareStatement("" //
+ "MERGE INTO data USING (VALUES(?, ?, ?, ?, ?, ?,
?, ?))" //
+ " AS vals (vid, vkey_, vtype_, vno_, vdouble_,
vstring_, vboolean_, vtimestamp_)" //
+ " ON (id, key_) = (vid, vkey_)" //
+ " WHEN MATCHED THEN UPDATE SET type_=vtype_,
no_=vno_, double_=vdouble_," //
+ " string_=vstring_, boolean_=vboolean_,
timestamp_=vtimestamp_" //
+ " WHEN NOT MATCHED THEN INSERT" //
+ " VALUES (vid, vkey_, vtype_, vno_, vdouble_,
vstring_, vboolean_, vtimestamp_)");
I get this:
[junit] Caused by: java.sql.SQLException: data type cast needed
for parameter or null literal
[junit] at org.hsqldb.jdbc.Util.sqlException(Util.java:208)
[junit] at
org.hsqldb.jdbc.JDBCPreparedStatement.<init>(JDBCPreparedStatement.java:3882)
[junit] at
org.hsqldb.jdbc.JDBCConnection.prepareStatement(JDBCConnection.java:637)
[junit] at org.stowbase.aperitivo.db.hsql.HsqlMap.<init>(HsqlMap.java:49)
Am I doing something wrong or is it a bug in HSQLDB? I am using
2.0.0-rc8 compiled for Java 1.5 based on a svn snakshop (Rev 3443).
My goal is to do Update/Insert faster than delete followed by an
insert (I have profiled my application and 80% of its time is spend on
doing that), what is the fastest way to do that in hsqldb (I usually
have 5-10 values to "upsert", and most of the time it will be an
insert)?
Regards,
--
Kim Hansen
Vadgårdsvej 3, 2.tv
2860 Søborg
Fastnet: 3956 2437 -- Mobil: 3091 2437
Kim Hansen
Vadgårdsvej 3, 2.tv
2860 Søborg
Fastnet: 3956 2437 -- Mobil: 3091 2437