Thanks for your message.

Try this in isolation: LocalDateTime.from(Instant.now()). It produces:

Exception in thread "main" java.time.DateTimeException: Unable to obtain
LocalDateTime from TemporalAccessor: 2024-02-20T07:53:51.119531500Z of type
java.time.Instant
at java.base/java.time.LocalDateTime.from(LocalDateTime.java:463)
at org.jooq.testscripts.JDBC.main(JDBC.java:40)
Caused by: java.time.DateTimeException: Unable to obtain LocalDate from
TemporalAccessor: 2024-02-20T07:53:51.119531500Z of type java.time.Instant
at java.base/java.time.LocalDate.from(LocalDate.java:403)
at java.base/java.time.LocalDateTime.from(LocalDateTime.java:458)
... 1 more


As you can see, this isn't related to jOOQ. You can see this from the stack
trace as well, the problem happens within LocalDateTime.from() and the
thing you're passing to LocalDateTime.from() is also in your code.

Why not just call LocalDateTime.now()

I hope this helps,
Lukas

On Mon, Feb 19, 2024 at 4:55 PM YANA <[email protected]> wrote:

> Hi!
> I will very grateful for your consultation. Faced exception, tied with
> TemporalAccessor.
> I see, that my TRANSACTIONS table generated using LocalDateTime type field
> for transaction_date column.
> During writing the tests I wanted to set transaction_date for several
> transactions I interested in. But there always throw exception.
> Details below:
> Generated  table field:
> ----------------------------------------------------------------
> public final TableField<Record, LocalDateTime> TRANSACTION_DATE =
> createField(DSL.name("TRANSACTION_DATE"), SQLDataType.LOCALDATETIME(6),
> this, "");
> ----------------------------------------------------------
> QUERY I want to use in tests:
> ----------------------------------------------------------
> jooq.update(TRANSACTIONS)
> .set(TRANSACTIONS.TRANSACTION_DATE, LocalDateTime.from(Instant.now()))
> .where(TRANSACTIONS.ID.in(uuid("fe44ac34-df26-d847-d013-6cc71b1e8193"
> )).execute();
>
> ---------------------------------------------------------------
> Exception:
> ---------------------------------------------------------------
> java.time.DateTimeException: Unable to obtain LocalDateTime from
> TemporalAccessor: 2024-02-18T15:20:55.286412600Z of type java.time.Instant
> Thanks in advance!
>
> --
> 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/b319e710-ffcc-4bf4-879d-2c924169589bn%40googlegroups.com
> <https://groups.google.com/d/msgid/jooq-user/b319e710-ffcc-4bf4-879d-2c924169589bn%40googlegroups.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/CAB4ELO4p4z2P6kxxX-GtGC_ZByiJy3Fk146%2BJReSY%3D_jx6sG%2Bg%40mail.gmail.com.

Reply via email to