1. Taro L. Saito
  2. sqlite-jdbc
  3. Issues
Issue #45 resolved

Stmt.close() should not close metadata

Rafael Ribeiro
created an issue

Hi all,

I was doing some tests with latest code from trunk and noticed that a simple hibernate flow that inserts an Entity fails since Stmt.close is inadvertently closing its metadata object instance instead of just removing its reference, which in turn makes any other statement fail since Connection's metadata is closed also. A simple change on Stmt class, line 133 does the fix, instead of having: metadata.close() we should ideally have metadata = null; and everything is fine.

Comments (6)

  1. Rafael Ribeiro reporter
    • changed status to open

    I am providing a sample maven project that will fail if executed against trunk (3.7.17-SNAPSHOT as of today). Also it makes completely NO SENSE in closing connection metadata instance when a statement is closed. It makes perfect sense in the other way around, if metadata instance was being closed as a result of closing connection metadata.

  2. Rafael Ribeiro reporter

    just run main class and you'll get a Exception in thread "main" java.lang.NullPointerException at org.sqlite.MetaData.getGeneratedKeys(MetaData.java:1844) at org.sqlite.Stmt.getGeneratedKeys(Stmt.java:417) on second insert and any attempt beyond the first one...

  3. Log in to comment