Hi Lukas
First thanks a lot for your input!
> a) Your SQLite database doesn't support _rowid_. Could you check that,
please? Some more info can be found here [1]
I did some checks in that area, _rowid_ seems to work
> Given, that this line here [2] throws a NullPointerException, I'm pretty
sure that b) is the problem here.
While playing around, I switched my data source
from org.springframework.jdbc.datasource.DriverManagerDataSource
to org.apache.commons.dbcp.BasicDataSource and I got a more verbose error
description/exception:
org.jooq.exception.DataAccessException: SQL [select Project.ID from Project
where _rowid_ = ?]; Connection is closed.
at org.jooq.impl.Utils.translate(Utils.java:1021)
at
org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:462)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:287)
at org.jooq.impl.AbstractResultQuery.fetch(AbstractResultQuery.java:309)
at org.jooq.impl.AbstractResultQuery.fetchInto(AbstractResultQuery.java:596)
at org.jooq.impl.SelectImpl.fetchInto(SelectImpl.java:1203)
at org.jooq.impl.AbstractStoreQuery.execute(AbstractStoreQuery.java:260)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:283)
at
org.jooq.impl.UpdatableRecordImpl.storeInsert(UpdatableRecordImpl.java:176)
at org.jooq.impl.UpdatableRecordImpl.insert(UpdatableRecordImpl.java:147)
at
ch.netcetera.billyboy.service.model.ProjectDAOImpl.persist(ProjectDAOImpl.java:46)
[...]
Caused by: java.sql.SQLException: Connection is closed.
at
org.apache.commons.dbcp.DelegatingConnection.checkOpen(DelegatingConnection.java:274)
at
org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:214)
at
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:297)
at
org.jooq.impl.ProviderEnabledConnection.prepareStatement(ProviderEnabledConnection.java:103)
at
org.jooq.impl.SettingsEnabledConnection.prepareStatement(SettingsEnabledConnection.java:71)
at
org.jooq.impl.ProviderEnabledConnection.prepareStatement(ProviderEnabledConnection.java:103)
at
org.jooq.impl.SettingsEnabledConnection.prepareStatement(SettingsEnabledConnection.java:71)
at org.jooq.impl.AbstractResultQuery.prepare(AbstractResultQuery.java:184)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:265)
... 38 more
It seems that somehow the connection is closed too early (before step 3).
That would also explain why switching the jdbc driver didn't help.
As a consequence, I tried to simulate what jooq does:
jdbcTemplate.execute("insert into Project (Name, Code, Company) values
('testname', 'code1234', 'abc')");
int rowId = jdbcTemplate.queryForInt("select last_insert_rowid()");
int projectId = jdbcTemplate.queryForInt("select Project.ID from
Project where _rowid_ = ?", new Object[] {rowId});
... and this works perfectly! Therefore, could it be that jOOQ somehow
triggers the closing of the connection (too early)? On the other hand, you
said you couldn't reproduce the problem on your side...
Cheers, Michele
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.