Oh, I see, my bad. I overlooked that you were assigning your value to an
int type. You cannot do that for nullable values as auto unboxing will
throw NullPointerExceptions. Think of your code:

int tipo = r.get(PEOPLE.TIPORESTRICAO);


As being syntactic sugar for:

int tipo = r.get(PEOPLE.TIPORESTRICAO).intValue();


So, you either have to implement null safe logic, or assign your value to
an Integer variable.

Hope this helps,
Lukas

On Fri, Aug 31, 2018 at 7:13 PM Junior Manzini <[email protected]>
wrote:

> Hello Lukas, thanks for your time, I'm not using fetchOne (), just fetch ()
> was to return more than 1000 records but stops at 43, when the value in
> the TIPORESTRICAO field is null.
>
> try {
>             ctx = DSL.using(connection, SQLDialect.MYSQL);
>
>             Result<Record> result = ctx.select()
>                     .from(PEOPLE)
>                     .orderBy(PEOPLE.LNUM)
>                     .fetch();
>
>             for (Record r : result) {
>                 pesquisaResponsavelDto = new PesquisaResponsavelDto();
>
> pesquisaResponsavelDto.setResponsavelID(r.getValue(PEOPLE.LNUM));
>                 int tipo = r.get(PEOPLE.TIPORESTRICAO);
>                 responsavelList.add(pesquisaResponsavelDto);
>             }
>         } catch (Exception e) {
>                 e.printStackTrace();
>         } finally {
>             if (ctx != null) {
>                 ctx.close();
>             }
>         }
>
> Em quinta-feira, 30 de agosto de 2018 08:31:58 UTC-3, Junior Manzini
> escreveu:
>>
>>
>> Hi... In the table I'm working on there is a field type SMALLINT, where
>> some are null when trying to get this data (null) r.getValue (PEOPLE.TYPE)
>> gives exception (null pointer) which does not happen when the field is
>> VARCHAR or BLOB, these I can handle when they are null, Is there any way to
>> test the null before reading?
>>
>> Thanks
>>
> --
> 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.

Reply via email to