finally get jooq and his code generation working

This commit is contained in:
mykola2312 2024-04-18 14:27:35 +03:00
parent 273968fd9d
commit 32aa5a9bb0
3 changed files with 19 additions and 3 deletions

View file

@ -109,8 +109,10 @@
</jdbc>
<generator>
<name>org.jooq.codegen.JavaGenerator</name>
<database>
<includes>\*.</includes>
<name>org.jooq.meta.sqlite.SQLiteDatabase</name>
<includes>.*</includes>
<excludes>flyway_schema_history</excludes>
</database>
<generate>

View file

@ -5,9 +5,14 @@ import com.mykola2312.mptv.ui.MainFrame;
import org.apache.commons.cli.*;
import org.apache.log4j.Logger;
import org.flywaydb.core.Flyway;
import org.flywaydb.core.api.configuration.Configuration;
import static com.mykola2312.mptv.tables.Test.*;
import org.jooq.*;
import org.jooq.Record;
import org.jooq.impl.*;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
public class Main {
public static void main(String[] args) {
@ -48,6 +53,14 @@ public class Main {
);
flyway.migrate();
try (Connection conn = DriverManager.getConnection("jdbc:sqlite:mptv.db", "", "")) {
DSLContext create = DSL.using(conn, SQLDialect.SQLITE);
Result<Record> result = create.select().from(TEST).fetch();
System.out.println(result);
} catch (Exception e) {
e.printStackTrace();
}
Logger logger = Logger.getLogger(Main.class);
logger.info("mptv started");
}

View file

@ -1,3 +1,4 @@
CREATE TABLE test (
id INTEGER PRIMARY KEY AUTOINCREMENT
id INTEGER PRIMARY KEY AUTOINCREMENT,
value TEXT NOT NULL
);