Hi David,

But it *is* nullable. In SQL, everything is nullable. Rationale here:
https://blog.jooq.org/2017/07/25/5-things-you-may-not-have-known-about-jooq/#thing1

One simple example would be using a LEFT JOIN:

SELECT c.*
FROM x
LEFT JOIN t_customer c
ON false

If you run this query with jOOQ, pretending that your columns are NOT NULL
would be a mistake. The same is true with unions, expressions, and many
other SQL features, and even with deferred constraints or triggers, which
we are currently unaware of.

There might be a flag in the future that allows you to override this at
your own risk:
https://github.com/jOOQ/jOOQ/issues/10212

In addition to that, you may choose to project only 2 columns but still map
your record into the POJO that has been generated. Another source of nulls
in jOOQ...

Are those ill-formatted JPA annotations a copy paste artifact, or generated
that way?

I hope this helps,
Lukas

On Wed, Oct 21, 2020 at 5:42 PM David Karlsen <[email protected]>
wrote:

> Great - now I get kotlin code!
> But I think the generator could be tightened a bit:
>
> create table T_CUSTOMER (
>     id number(19,0) not null, -- generated PK
>
>
> record:
>
> var id: BigInteger?
>     set(value) = set(0, value)
> @Id
> @Column(name = "ID", nullable = false, precision = 19)
>     get() = get(0) as BigInteger?
>
> if it is not nullable - then it can be BigInteger - not BigInteger?
>
> same with pojo:
>
> data class TCustomer(
>       var id: BigInteger? = null
>     , var version: BigInteger? = null
>     , var customerid: String? = null
>     , var orgid: String? = null
>     , var firstname: String? = null
>     , var lastname: String? = null
>     , var createdDt: LocalDateTime? = null
>     , var updatedDt: LocalDateTime? = null
> ): Serializable {
>
>
> wdyt?
>
> ons. 21. okt. 2020 kl. 16:45 skrev Lukas Eder <[email protected]>:
>
>> The code is the same, yes. But in order to activate it, you have to use:
>>
>> <configuration>
>>   <generator>
>>     <name>org.jooq.codegen.KotlinGenerator</name>
>>   </generator>
>> </configuration>
>>
>>
>> This will be documented soon.
>>
>> On Wed, Oct 21, 2020 at 3:19 PM David Karlsen <[email protected]>
>> wrote:
>>
>>> Isn't the same generator used under the hood from the maven plugin? I
>>> want Kotlin code since my app is kotlin (except for generated jooq and
>>> openapi code). If it is possible to get all code generated as Kotlin I'd
>>> prefer that.
>>> Thanks.
>>>
>>> ons. 21. okt. 2020 kl. 14:49 skrev Lukas Eder <[email protected]>:
>>>
>>>> Hi David,
>>>>
>>>> This flag currently requires using the KotlinGenerator. I guess it
>>>> would make sense to enable it also in the JavaGenerator? Was that your
>>>> expectation? Is there a reason why you'd like Kotlin data classes, but all
>>>> the other generated classes as ordinary Java classes?
>>>>
>>>> Thanks,
>>>> Lukas
>>>>
>>>> On Wed, Oct 21, 2020 at 2:28 PM David Karlsen <[email protected]>
>>>> wrote:
>>>>
>>>>> I have a configuration section like:
>>>>>
>>>>> <generate>
>>>>>   <javaTimeTypes>true</javaTimeTypes>
>>>>>   <jpaAnnotations>true</jpaAnnotations>
>>>>>   <jpaVersion>2.2</jpaVersion>
>>>>>   <pojosAsKotlinDataClasses>true</pojosAsKotlinDataClasses>
>>>>>   <pojosEqualsAndHashCode>true</pojosEqualsAndHashCode>
>>>>>   <pojos>true</pojos>
>>>>>   <daos>true</daos>
>>>>>   <validationAnnotations>false</validationAnnotations>
>>>>>   <springAnnotations>true</springAnnotations>
>>>>> </generate>
>>>>>
>>>>> but still the classes generated are .java and not Kotlin.
>>>>>
>>>>> --
>>>>> --
>>>>> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
>>>>>
>>>>> --
>>>>> 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].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/jooq-user/CAGO7Ob3zK2Nhqo0WCMMfLyMoqAEGzy2E7Cw6G-6XizkObXfYdQ%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/jooq-user/CAGO7Ob3zK2Nhqo0WCMMfLyMoqAEGzy2E7Cw6G-6XizkObXfYdQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> 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].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jooq-user/CAB4ELO4Y3hhFJ-%3DxP_JWQKse55DXTJcBHk4r6_-yV8tGOEs2%2Bg%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/jooq-user/CAB4ELO4Y3hhFJ-%3DxP_JWQKse55DXTJcBHk4r6_-yV8tGOEs2%2Bg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>>>
>>> --
>>> --
>>> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
>>>
>>> --
>>> 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].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jooq-user/CAGO7Ob1jpOvyiEU%3DUz%2Bxj1B5XCU%3D7au731BsNDWO9VHXJRbdXQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/jooq-user/CAGO7Ob1jpOvyiEU%3DUz%2Bxj1B5XCU%3D7au731BsNDWO9VHXJRbdXQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jooq-user/CAB4ELO7Co4tPz-9MiqBEFyPRAHBF%3D2K5v1H9uZLdj8u_ynSY9w%40mail.gmail.com
>> <https://groups.google.com/d/msgid/jooq-user/CAB4ELO7Co4tPz-9MiqBEFyPRAHBF%3D2K5v1H9uZLdj8u_ynSY9w%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> --
> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
>
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jooq-user/CAGO7Ob2SzUEziCyp1q63Ck%3DCO-ZiqCicZ8ikc5LwwT93-7jdFA%40mail.gmail.com
> <https://groups.google.com/d/msgid/jooq-user/CAGO7Ob2SzUEziCyp1q63Ck%3DCO-ZiqCicZ8ikc5LwwT93-7jdFA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/CAB4ELO7UNrH7r_DMTbpS4sGt0Xhm_q-gUTe%2Bsf26pWCfLzUziw%40mail.gmail.com.

Reply via email to