Lukas, Since this only hits test code (nothing else I do sets the id column on an insert), I can work around it. I was really trying to do some archaeology and understand what caused the change and why. I was unable to pinpoint it in the notes,
My tests were based on my old architecture which didn't do nice things like return the id column upon insert/update. So, my tests can be refactored without having a workaround. While you're thinking about 4.0 behavior, I don't really mind either way whether the column is there or not upon insert. What is important is that unless the value is set, I'd rather the DataType control its content and use the default value. I'm not at the point in understanding the codebase to be able to suggest a fix. Finally, what are your plans for jOOQ-test? Are you planning to add it as a submodule and have it run all the tests? OR are you thinking about moving it under jOOQ into src/test/*? I wouldn't mind playing with getting that under CI in my spare time, but wanted to head in the right direction. Tests help me grok a codebase better than docs anyhow. Thanks, Jason On Tue, Jan 7, 2014 at 7:16 AM, Lukas Eder <[email protected]> wrote: > Hi Jason, > > That is the expected behaviour, although it has been challenged a couple > of times on this user group. The various threads are summarised in this > feature request here: > https://github.com/jOOQ/jOOQ/issues/2704 > > The observed behaviour is due to the fact that setting the primary key > value alters changed flags for all fields in a record. The rationale behind > this originates from jOOQ 1.x's "copy" semantics, where records can be > copied by simply changing the primary key. > > It is likely that this behaviour will be deprecated for jOOQ 4.0. The > above #2704 will at least add a setting that will remove such magic > behaviour from jOOQ's UpdatableRecords. Unfortunately, you'll have to find > a creative solution to work around this issue. E.g. one that is inspired by > Marko Topolnik's solution here: > https://groups.google.com/d/msg/jooq-user/8MBETRVrLCM/-D0XsBYtwywJ > > Cheers > Lukas > > > 2014/1/7 Jason Herr <[email protected]> > >> Lukas, >> >> I've been playing with 3.2.2 in my sandbox and ran into an issue in my >> app. While trying to recreate in your test code I ran into a few issues >> with the changes inserted for issue 2835. >> >> >> https://github.com/jOOQ/jOOQ/commit/8875940e9d4ba5846ffaae6ce8735240ba62af09 >> >> The SQL is updated for the h2 test, but not the generated code. >> >> Either way, in PostgreSQL I have a table with the following columns: >> >>> >>> Table "public.example" >>> Column | Type | >>> Modifiers >>> >>> ------------------+--------------------------+------------------------------- >>> id | integer | not null default >>> nextval('example_id_seq'::regclass) >>> data | text | not null >> >> more_data | text | >>> check | boolean | not null default false >> >> >> In 3.2.0 if you generate the record and run: >> ExampleRecord exampleRecord = new ExampleRecord(); >> exampleRecord.setId(42); // Because I'm running integration tests and am >> crazy that way... >> exampleRecord.setData("text"); >> exampleRecord.store(); >> >> The select statement is: >> >> insert into "public"." example" ("id", "data", "more_data", "check") >> values (42, 'text') returning "public"."example"."id" >> >> In 3.2.2 the select statement is: >> insert into "public"." example" ("id", "data", "more_data", "check") >> values (42, 'text', null, null) returning "public"."example"."id" >> >> I stepped through the store call while running against the 3.2.2 code to >> determine if I could see where the change came from, but was unable to do >> so. I am going to continue looking at it, but figured I would ask if you >> or anyone had noticed this issue. >> >> Thanks, >> Jason >> >> -- >> 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. >> > > -- > 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. > -- 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.
