Monday 15 February 2010

java - SQLite 64bit integers recognized as ints in jooq -



java - SQLite 64bit integers recognized as ints in jooq -

i have sqlite database using jooq. when utilize jooq's code generation tool, builds of table , record classes expected. however, of sqlite integer columns turn java.lang.integer fields in generated code.

the problem sqlite integer's can store 64 bit signed integer, java.lang.integer 32 bit signed integer.

is possible tell jooq utilize java.lang.long (which 64 bit signed) these columns?

in fact, there no such thing actual integer info type in sqlite, integer affinity, can indeed store 64 bit signed integers. however, when utilize ddl, typically utilize 1 of these (mostly) standard "type names", can used in create table statements , cast expressions:

int integer tinyint smallint mediumint bigint unsigned big int int2 int8

in order jooq generate java.lang.long, need utilize 1 of bigint or int8 in create table statement. if utilize int or integer, jooq assume intended storing 32 bit signed integers, , java.lang.integer values.

rewriting info types

note jooq's code generator configuration allows rewrite info types based on column names or column types:

class="lang-xml prettyprint-override"><forcedtype> <!-- specify info type org.jooq.impl.sqldatatype --> <name>bigint</name> <!-- add together java regular look matching fully-qualified columns. utilize pipe (union operator) separate several expressions. if provided, both "expressions" , "types" must match. --> <expression>.*\.is_valid</expression> <!-- add together java regular look matching info types forced have type. if provided, both "expressions" , "types" must match. --> <types>.*</types> </forcedtype>

java sqlite long-integer jooq

No comments:

Post a Comment