I've tried reproducing this on my side, without any success. The following
two integration tests work. Would it be possible to provide an MVCE (
https://stackoverflow.com/help/mcve), preferably as a minimal Maven project
that contains all the relevant classes. Perhaps, when you showed the
examples in this discussion, some important detail got missing...
Working tests:
static class BaseAuthorNoGetters {
int id;
}
static class SubAuthorNoGetters extends BaseAuthorNoGetters {
String lastName;
}
public void testInsertWithRecordFromPojoWithInheritanceNoGetters()
throws Exception {
jOOQAbstractTest.reset = false;
SubAuthorNoGetters author = new SubAuthorNoGetters();
author.id = 3;
author.lastName = "A";
assertEquals(1, create().newRecord(TAuthor(), author).store());
assertEquals("A", create()
.select(TAuthor_LAST_NAME())
.from(TAuthor())
.where(TAuthor_ID().eq(3))
.fetchOne(TAuthor_LAST_NAME()));
author.lastName = "B";
assertEquals(1,
create().executeUpdate(create().newRecord(TAuthor(), author)));
assertEquals("B", create()
.select(TAuthor_LAST_NAME())
.from(TAuthor())
.where(TAuthor_ID().eq(3))
.fetchOne(TAuthor_LAST_NAME()));
}
static class BaseAuthorWithGetters {
int id;
public int getId() {
return id;
}
}
static class SubAuthorWithGetters extends BaseAuthorWithGetters {
String lastName;
public String getLastName() {
return lastName;
}
}
public void testInsertWithRecordFromPojoWithInheritanceWithGetters()
throws Exception {
jOOQAbstractTest.reset = false;
SubAuthorWithGetters author = new SubAuthorWithGetters();
author.id = 3;
author.lastName = "A";
assertEquals(1, create().newRecord(TAuthor(), author).store());
assertEquals("A", create()
.select(TAuthor_LAST_NAME())
.from(TAuthor())
.where(TAuthor_ID().eq(3))
.fetchOne(TAuthor_LAST_NAME()));
author.lastName = "B";
assertEquals(1,
create().executeUpdate(create().newRecord(TAuthor(), author)));
assertEquals("B", create()
.select(TAuthor_LAST_NAME())
.from(TAuthor())
.where(TAuthor_ID().eq(3))
.fetchOne(TAuthor_LAST_NAME()));
}
2018-05-03 11:33 GMT+02:00 xragons <[email protected]>:
> Yeap, I understand. It truly is great effort from your part. Working on
> the code base and helping others is truly humble of you. I've seen Stack
> overflow posts of you helping discussing with others years back. The
> dedication is fascinating.
>
> Also, I forgot to mention its not only for the executeUpdate(), even
> store() and excuteInsert don't work in my case.
>
> Thanks.
>
> On Thursday, May 3, 2018 at 5:18:11 AM UTC-4, Lukas Eder wrote:
>
>>
>>
>> 2018-05-03 11:09 GMT+02:00 xragons <[email protected]>:
>>
>>>
>>> The updating isn't even going through.
>>>
>>> when I replace this
>>>
>>>
>>> BooksRecord book = create.newRecord(BOOKS, myBook);
>>>
>>>
>>>
>>> with this:
>>>
>>>
>>> BooksRecord book = create.newRecord(BOOKS, BookClass.class);
>>>
>>>
>>>
>>> it'll update in the DB but with just the (BookClass.class) in string
>>> format. So I think the issue lies somewhere here?
>>>
>>
>> The latter doesn't really make any sense - what would be the meaning of
>> loading a Class reference into a jOOQ Record?
>>
>> Do understand that when loading a POJO into a Record using the syntax
>> you're using, behind the scenes, the DefaultRecordUnmapper is applied to
>> your POJO to produce a Record:
>> https://www.jooq.org/javadoc/latest/org/jooq/impl/DefaultRec
>> ordUnmapper.html
>>
>> It uses reflection to map between getters (and other convention) and
>> record field names. The specification is in the Javadoc. After unmapping,
>> all the Record.changed() flags are set to true, which influences the
>> semantics of an UpdatableRecord.update() call, also according to the
>> documentation.
>>
>> Now, there might be a bug in the DefaultRecordUnmapper logic, which I
>> will need to investigate...
>>
>>
>>> Discord is basically like skype / teamspeak / msn. But on a larger
>>> scale. Business use it for communication, while gamers use it to stay in
>>> touch. You should check it out. It's free and highly customizable.
>>> Basically visitors or staff can post/discuss in real time. But that might
>>> go against what this whole group is for, but you should still look into it
>>> and see if it fits your style.
>>>
>>
>> Oh I see - I wasn't aware that it is a product name, thanks for the
>> suggestion.
>>
>> I don't think that a chat (regardless of the vendor) is an appropriate
>> channel for community support. We have enterprise support subscriptions for
>> customers who wish more timely responses on a 1:1 email basis. Public
>> community support on this list is for asynchronous, "offline" support,
>> which is provided on a best effort basis.
>>
>>
>>
> --
> 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/d/optout.
>
--
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/d/optout.