[sqlite]missing sqlite_sequence

1,410 views
Skip to first unread message

Pay Liu

unread,
Jul 4, 2013, 10:43:30 PM7/4/13
to jooq...@googlegroups.com
Hi @Lukas

When I run codegen for sqlite db, I got a error as below.
It seem to be caused by missing table sqlite_sequence.

I checked the docSQLite Autoincrement.

That table sqlite_sequence is created automatically when create a table contain AUTOINCREMENT column, such as 

CREATE TABLE table_name (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT
);

In my case, I do NOT use any AUTOINCREMENT column, so I don't have a table sqlite_sequence.

For now, a workaround is ...
create a "dummy" table that contain AUTOINCREMENT and sqlite will produce sqlite_sequence for me. 
And then code-gen is working.


Still ask, is there another way to avoid this issue by configuration or input parameter?? 

or AUTOINCREMENT is must for using jooq?

thanks!!

- Pay.




=====ERROR MESSAGE====
SEVERE: Error while generating table zorder_option
org.jooq.exception.DataAccessException: SQL [select count(*) from sqlite_sequence where name = ?]; [SQLITE_ERROR] SQL error or missing database (no such table: sqlite_sequence)
at org.jooq.impl.Utils.translate(Utils.java:1078)
at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:462)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:302)
at org.jooq.impl.AbstractResultQuery.fetchLazy(AbstractResultQuery.java:339)
at org.jooq.impl.AbstractResultQuery.fetchLazy(AbstractResultQuery.java:330)
at org.jooq.impl.AbstractResultQuery.fetchOne(AbstractResultQuery.java:458)
at org.jooq.impl.DefaultDSLContext.fetchOne(DefaultDSLContext.java:419)
at org.jooq.util.sqlite.SQLiteTableDefinition.getElements0(SQLiteTableDefinition.java:77)
at org.jooq.util.AbstractElementContainerDefinition.getElements(AbstractElementContainerDefinition.java:80)
at org.jooq.util.AbstractTableDefinition.getColumns(AbstractTableDefinition.java:135)
at org.jooq.util.AbstractTableDefinition.getPrimaryKey(AbstractTableDefinition.java:74)
at org.jooq.util.JavaGenerator.generateTable(JavaGenerator.java:1359)
at org.jooq.util.JavaGenerator.generateTables(JavaGenerator.java:1348)
at org.jooq.util.JavaGenerator.generate(JavaGenerator.java:190)
at org.jooq.util.JavaGenerator.generate(JavaGenerator.java:174)
at org.jooq.util.GenerationTool.run(GenerationTool.java:291)
at org.jooq.util.GenerationTool.main(GenerationTool.java:135)
at org.jooq.util.GenerationTool.main(GenerationTool.java:122)
Caused by: java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (no such table: sqlite_sequence)
at org.sqlite.DB.newSQLException(DB.java:886)
at org.sqlite.DB.newSQLException(DB.java:897)
at org.sqlite.DB.throwex(DB.java:864)
at org.sqlite.NativeDB.prepare(Native Method)
at org.sqlite.DB.prepare(DB.java:207)
at org.sqlite.PrepStmt.<init>(PrepStmt.java:50)
at org.sqlite.SQLiteConnection.prepareStatement(SQLiteConnection.java:616)
at org.sqlite.SQLiteConnection.prepareStatement(SQLiteConnection.java:606)
at org.sqlite.SQLiteConnection.prepareStatement(SQLiteConnection.java:578)
at org.jooq.impl.ProviderEnabledConnection.prepareStatement(ProviderEnabledConnection.java:107)
at org.jooq.impl.SettingsEnabledConnection.prepareStatement(SettingsEnabledConnection.java:71)
at org.jooq.impl.AbstractResultQuery.prepare(AbstractResultQuery.java:220)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:272)

Lukas Eder

unread,
Jul 5, 2013, 3:46:35 AM7/5/13
to jooq...@googlegroups.com
Hello,

Thanks for reporting this. This is a bug, for which I have registered #2608.

jOOQ should not assume that the sqlite_sequence table exists. In the mean time, create a dummy table to force the generation of this sqlite_sequence table, as a workaround.

Cheers
Lukas

2013/7/5 Pay Liu <pay...@gmail.com>

--
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 jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Pay Liu

unread,
Jul 5, 2013, 6:47:14 PM7/5/13
to jooq...@googlegroups.com
Wow, you already closed this issue, very soon, thanks:)

Lukas Eder於 2013年7月5日星期五UTC+8下午3時46分35秒寫道:
Reply all
Reply to author
Forward
0 new messages