No worries :) On Tuesday, February 20, 2024, YANA <[email protected]> wrote:
> LocalDateTime.now() really works. > Thanks a lot for answer. The problem is only in my experience and may be > in attentiveness absence at the end of day. So excuse me I took you time. > Have a nice day! > вторник, 20 февраля 2024 г. в 08:56:23 UTC+1, [email protected]: > >> 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/fef5c69d-762b-472b-97ca-b331c214d0a0n%40googlegroups.com > <https://groups.google.com/d/msgid/jooq-user/fef5c69d-762b-472b-97ca-b331c214d0a0n%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/CAB4ELO71A8f6b6ZaNHg3wDFUaYNMncYZKmUZdGAZaZV3ewgYiA%40mail.gmail.com.
