0

I was looking for a solution to my problem. I was coding my JdbcImpl file and I got an error when I was coding this : rs.getDate create an error in a screen

Enchere enchereResultSet = new Enchere(
    //Changer le getDate to LocalDateTime
rs.getDate("date_encheres"),
rs.getInt("montant_enchere"),
rs.getInt("no_article"),
rs.getInt("no_utilisateur"));

I found the fix! It seems simple, just go for this instead:

Enchere enchereResultSet = new Enchere(
    //Changer le getDate to LocalDateTime
rs.getTimestamp("date_enchere").toLocalDateTime(),
rs.getInt("montant_enchere"),
rs.getInt("no_article"),
rs.getInt("no_utilisateur"));

The solution in a screen

Do I have the right to share the fix if I found it while writing a post here? I share it because it will maybe help beginner like me in the future.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • You are welcome and encouraged to post and accept an Answer to your own Question. See meta.stackoverflow.com for details. – Basil Bourque Jan 07 '22 at 07:34
  • Your fix is the wrong one (it works, but it may have unnecessary overhead). You should use `rs.getObject("date_enchere", LocalDateTime.class)`. Note that if you used `getDate` before, and you are actually retrieving date information, then use `LocalDate`: `rs.getObject("date_enchere", LocalDate.class)` – Mark Rotteveel Jan 07 '22 at 09:30

0 Answers0