I'm currently using JDBI on a project with a DAO like:
@SqlBatch("insert_continent")
fun insertContinents(@BindBean continents: List)
Note this uses the @BindBean to automatically bind bean properties to sql
statements.
E.g. the insert_continent sql file contains:
INSERT INTO continent
( id
,
Hi Marcel,
The SQL DSL can't do that for you, but you can turn any POJO into a Record
using Record.from() or DSLContext.newRecord(...). You can then use
.insertInto(table).set(record). There's a RecordUnmapper SPI that governs
how to "unmap" POJOs into records, with a DefaultRecordUnmapper
impleme
Hi Lukas, and thanks for your reply. This helps a lot.
I used jOOQ In the past with code generation and I understand the benefits
especially in terms of type information and type safety.
In my case I'm not having a dynamic schema, but also not an active database
(I need to generate create table s
Hi Marcel,
On Mon, Mar 18, 2024 at 3:38 PM Marcel Overdijk
wrote:
> Hi Lukas, and thanks for your reply. This helps a lot.
>
> I used jOOQ In the past with code generation and I understand the benefits
> especially in terms of type information and type safety.
>
Sure, I knew you were aware of i
Yes I see. I will check out the RecordListener later then.
Btw, based on the generated classes, I wanted to see if I could generate
the DDL again from it ;-)
I came up with this:
// Table creation statement.
String create = ctx
.createTable(COUNTRY)
Related to generating the schema ddl I found there is the dsl.ddl(schema)
method of jooq.
So no need what I'm doing above ;-) and I changed my code to:
val jdbcUrl = "jdbc:sqlite:${outputFile.absolutePath}"
val jdbcProperties = Properties().apply {
setProperty("date_class", "text")
setPro
On Mon, Mar 18, 2024 at 10:26 PM Marcel Overdijk
wrote:
> Related to generating the schema ddl I found there is the dsl.ddl(schema)
> method of jooq.
Great that you've found it! :)
> I noticed it generates the ddl in the order:
> create table country ...
> create index ...
> alter table count
Thanks Lukas,
I created https://github.com/jOOQ/jOOQ/issues/16470 for this.
> We can do a topological sort.
That sounds hopeful! Not sure how to do it, so if there is anything you
share that would be great.
I'm also posting here some example using Mapstruct, for if somebody else
comes to this
On Tue, Mar 19, 2024 at 9:36 AM Marcel Overdijk
wrote:
> Thanks Lukas,
>
> I created https://github.com/jOOQ/jOOQ/issues/16470 for this.
>
> > We can do a topological sort.
>
> That sounds hopeful! Not sure how to do it, so if there is anything you
> share that would be great.
>
Well, if there