[jOOQ/jOOQ#5714] Update examples where Date is now LocalDate
With [jOOQ/jOOQ#5714] the default value of `<javaTimeTypes>` changed from `false` to `true`. This also requires a few changes in the example code.
This commit is contained in:
parent
7c08ea1e56
commit
680cd20d08
@ -41,8 +41,8 @@ import static org.jooq.academy.tools.Tools.connection;
|
||||
import static org.jooq.example.db.h2.Tables.AUTHOR;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.Date;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.academy.tools.Tools;
|
||||
@ -99,7 +99,7 @@ public class Example_1_3_DMLStatements {
|
||||
Tools.title("Update the DATE_OF_BIRTH column");
|
||||
Tools.print(
|
||||
dsl.update(AUTHOR)
|
||||
.set(AUTHOR.DATE_OF_BIRTH, Date.valueOf("1899-08-13"))
|
||||
.set(AUTHOR.DATE_OF_BIRTH, LocalDate.of(1899, 8, 13))
|
||||
.where(AUTHOR.ID.eq(3))
|
||||
.execute()
|
||||
);
|
||||
|
||||
@ -41,8 +41,8 @@ import static org.jooq.academy.tools.Tools.connection;
|
||||
import static org.jooq.example.db.h2.Tables.AUTHOR;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.Date;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.academy.tools.Tools;
|
||||
@ -63,7 +63,7 @@ public class Example_2_1_ActiveRecords {
|
||||
try {
|
||||
Tools.title("Loading and changing active records");
|
||||
author = dsl.selectFrom(AUTHOR).where(AUTHOR.ID.eq(1)).fetchOne();
|
||||
author.setDateOfBirth(Date.valueOf("2000-01-01"));
|
||||
author.setDateOfBirth(LocalDate.of(2000, 1, 1));
|
||||
author.store();
|
||||
Tools.print(author);
|
||||
|
||||
@ -85,7 +85,7 @@ public class Example_2_1_ActiveRecords {
|
||||
|
||||
|
||||
Tools.title("Updating an active record");
|
||||
author.setDateOfBirth(Date.valueOf("1899-08-13"));
|
||||
author.setDateOfBirth(LocalDate.of(1899, 8, 13));
|
||||
author.store();
|
||||
Tools.print(author);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user