Hi,

Actually, you are not using H2 version 1.3.173. You are using an old
version of H2 (1.3.159 according to the error code, [23505-159]). Could you
try with a newer version?

Regards,
Thomas



On Thu, Oct 31, 2013 at 12:07 PM, Tomáš Remeš <[email protected]> wrote:

> I test HTTP session persistence to db using latest WildFly application
> server (Beta2 - SNAPSHOT, h2 1.3.173). I use this connection url 
> "jdbc:h2:file;AUTO_SERVER=true;DB_CLOSE_ON_EXIT=FALSE",
> because I want database to survive serve shutdown. Occassionally I am
> facing following exception:
>
> Unique index or primary key violation: "PRIMARY_KEY_A ON
>>> PUBLIC.""binarybased_default_host_session_db_cluster""(ID)"; SQL statement:
>>
>> INSERT INTO "binarybased_default_host_session_db_cluster" (datum,
>>> version, id) VALUES(?,?,?) [23505-159]
>>
>>  at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
>>
>>  at org.h2.message.DbException.get(DbException.java:169)
>>
>>  at org.h2.message.DbException.get(DbException.java:146)
>>
>>  at org.h2.index.BaseIndex.getDuplicateKeyException(BaseIndex.java:81)
>>
>>  at org.h2.index.PageBtree.find(PageBtree.java:121)
>>
>>  at org.h2.index.PageBtreeLeaf.addRow(PageBtreeLeaf.java:146)
>>
>>  at org.h2.index.PageBtreeLeaf.addRowTry(PageBtreeLeaf.java:100)
>>
>>  at org.h2.index.PageBtreeIndex.addRow(PageBtreeIndex.java:105)
>>
>>  at org.h2.index.PageBtreeIndex.add(PageBtreeIndex.java:96)
>>
>>  at org.h2.table.RegularTable.addRow(RegularTable.java:130)
>>
>>  at org.h2.command.dml.Insert.insertRows(Insert.java:124)
>>
>>  at org.h2.command.dml.Insert.update(Insert.java:84)
>>
>>  at org.h2.command.CommandContainer.update(CommandContainer.java:71)
>>
>>  at org.h2.command.Command.executeUpdate(Command.java:212)
>>
>>  at
>>> org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:143)
>>
>>  at
>>> org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:129)
>>
>>
> You can also check full stack trace (slightly different) at
> https://issues.jboss.org/browse/WFLY-2409. I've taken brief look to h2
> code and I would like to ask at following - looking
> at org.h2.index.PageBtreeLeaf  int addRow(SearchRow row, boolean tryOnly)
> method line 145. What should happen when entryCount variable is not equal
> to 0? Then it's called find(row, false, true, true), where is following
> code construction:
>
> if (add && index.indexType.isUnique()) {
>>
>>                     if (!index.containsNullAndAllowMultipleNull(compare))
>>> {
>>
>>                         throw
>>> index.getDuplicateKeyException(compare.toString());
>>
>>                     }
>>
>>                 }
>>
>>
> First condition is always true in this case and unfortunately in my case
> also the second condition evaluates as true. I am not really sure, what
> could be the problem. I'll appreciate any suggestions. Thank's in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to