lbehnke / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

ArrayIndexOutOfBoundsException: 0 [50000-107] while inserting a record #59

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using H2-1.1.107 and Latest OpenJpa-snapshot builds in my
application(uses SpringFw @Transactional). I'm getting the following
exception while creating a new record. Hope this exception helps in finding
the issue as I don't have a test case to recreate it.

/**/PreparedStatement prep35 = conn3.prepareStatement("INSERT INTO
product_info (id, active, createdon, last_updatedon, available_quantity,
intransit_quantity, onhand_quantity, ordered_quantity, reserved_quantity,
total_cost, unit_cost, version, warehouse, branch, company, createdby,
last_updatedby, product) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?)", 1003, 1007);
02-09 12:28:08 jdbc: SESSION_PREPARE_READ_PARAMS 151
02-09 12:28:08 jdbc: 
/**/prep35.setLong(1, 533L);
02-09 12:28:08 jdbc: 
/**/prep35.setInt(2, 1);
02-09 12:28:08 jdbc: 
/**/prep35.setNull(3, 93);
02-09 12:28:08 jdbc: 
/**/prep35.setNull(4, 93);
02-09 12:28:08 jdbc: 
/**/prep35.setBigDecimal(5, new BigDecimal("360.0000"));
02-09 12:28:08 jdbc: 
/**/prep35.setBigDecimal(6, new BigDecimal("0"));
02-09 12:28:08 jdbc: 
/**/prep35.setBigDecimal(7, new BigDecimal("360.0000"));
02-09 12:28:08 jdbc: 
/**/prep35.setBigDecimal(8, new BigDecimal("0"));
02-09 12:28:08 jdbc: 
/**/prep35.setBigDecimal(9, new BigDecimal("0"));
02-09 12:28:08 jdbc: 
/**/prep35.setBigDecimal(10, new BigDecimal("1766.52"));
02-09 12:28:08 jdbc: 
/**/prep35.setBigDecimal(11, new BigDecimal("4.9070"));
02-09 12:28:08 jdbc: 
/**/prep35.setInt(12, 1);
02-09 12:28:08 jdbc: 
/**/prep35.setLong(13, 3L);
02-09 12:28:08 jdbc: 
/**/prep35.setLong(14, 1L);
02-09 12:28:08 jdbc: 
/**/prep35.setLong(15, 1L);
02-09 12:28:08 jdbc: 
/**/prep35.setLong(16, 1L);
02-09 12:28:08 jdbc: 
/**/prep35.setLong(17, 1L);
02-09 12:28:08 jdbc: 
/**/prep35.setLong(18, 21L);
65055  my-entities  TRACE  [] openjpa.jdbc.SQL - <t 5963049, conn 33104079>
executing prepstmnt 7758324 INSERT INTO product_info (id, active,
createdon, last_updatedon, available_quantity, intransit_quantity,
onhand_quantity, ordered_quantity, reserved_quantity, total_cost,
unit_cost, version, warehouse, branch, company, createdby, last_updatedby,
product) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[params=(long) 533, (int) 1, (null) null, (null) null, (BigDecimal)
360.0000, (BigDecimal) 0, (BigDecimal) 360.0000, (BigDecimal) 0,
(BigDecimal) 0, (BigDecimal) 1766.52, (BigDecimal) 4.9070, (int) 1, (long)
3, (long) 1, (long) 1, (long) 1, (long) 1, (long) 21]
02-09 12:28:08 jdbc: 
/**/prep35.executeUpdate();
02-09 12:28:08 jdbc: COMMAND_EXECUTE_UPDATE 151
02-09 12:28:08 jdbc: SQLException
org.h2.jdbc.JdbcSQLException: General error:
java.lang.ArrayIndexOutOfBoundsException: 0 [50000-107]
    at org.h2.message.Message.getSQLException(Message.java:103)
    at org.h2.message.Message.convert(Message.java:274)
    at org.h2.table.TableData.addRow(TableData.java:135)
    at org.h2.command.dml.Insert.update(Insert.java:96)
    at org.h2.command.CommandContainer.update(CommandContainer.java:71)
    at org.h2.command.Command.executeUpdate(Command.java:207)
    at org.h2.server.TcpServerThread.process(TcpServerThread.java:297)
    at org.h2.server.TcpServerThread.run(TcpServerThread.java:136)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
    at org.h2.util.IntArray.get(IntArray.java:56)
    at org.h2.index.BtreeNode.add(BtreeNode.java:104)
    at org.h2.index.BtreeIndex.add(BtreeIndex.java:223)
    at org.h2.table.TableData.addRow(TableData.java:117)
    ... 6 more

    at org.h2.engine.SessionRemote.done(SessionRemote.java:540)
    at org.h2.command.CommandRemote.executeUpdate(CommandRemote.java:193)
    at
org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.ja
va:137)
    at
org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:126)
    at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPrep
aredStatement.java:102)
    at
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(Delegating
PreparedStatement.java:269)
    at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$Logging
PreparedStatement.executeUpdate(LoggingConnectionDecorator.java:981)
    at
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(Delegating
PreparedStatement.java:269)
    at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeU
pdate(JDBCStoreManager.java:1582)
    at
org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.executeUpdate(Prepar
edStatementManagerImpl.java:219)
    at
org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushAndUpdate(Prepa
redStatementManagerImpl.java:112)
    at
org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushAndUpda
te(BatchingPreparedStatementManagerImpl.java:80)
    at
org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInternal(Prepar
edStatementManagerImpl.java:93)
    at
org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush(PreparedStatem
entManagerImpl.java:81)
    at
org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateMan
ager.java:549)
    at
org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateMan
ager.java:106)
    at
org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager.flush(BatchingCon
straintUpdateManager.java:59)
    at
org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager
.java:89)
    at
org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager
.java:72)
    at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:713)
    at
org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.ja
va:130)
    at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2014)
    at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1912)
    at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1683)
    at org.apache.openjpa.kernel.QueryImpl.isInMemory(QueryImpl.java:959)
    at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:836)
    at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:777)
    at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:525)
    at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:257)
    at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:431)

I can provide further details, If you need any.

Thanks,
Prashant

Original issue reported on code.google.com by prashant...@gmail.com on 9 Feb 2009 at 4:44

GoogleCodeExporter commented 9 years ago
I dropped the table and created it again, now it's working properly! 

May be it's because the database was created using earlier versions. Are there 
any
commands to be executed while updating to latest versions?

Thanks,
Prashant

Original comment by prashant...@gmail.com on 9 Feb 2009 at 7:22

GoogleCodeExporter commented 9 years ago
Hi,

I suggest to use SCRIPT TO '<fileName>' to create a SQL script,
and then use RUNSCRIPT FROM '<fileName>' to create a new database.
There are also command line tools that do the same
(Script and RunScript).

Regards,
Thomas

Original comment by thomas.t...@gmail.com on 27 Feb 2009 at 4:40

GoogleCodeExporter commented 9 years ago
I set the bug to fixed as it works with a newer version.
If it fails again please re-open the bug.

Original comment by thomas.t...@gmail.com on 14 Mar 2009 at 11:17