Skip to content

Commit e512a61

Browse files
committed
Dto Via JDK14 Records And JdbcTemplate
1 parent 835253f commit e512a61

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

HibernateSpringBootDtoRecordJbcTemplate/src/main/java/com/bookstore/jdbcTemplate/dto/AuthorDto.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package com.bookstore.jdbcTemplate.dto;
22

33
import java.util.List;
4+
import java.io.Serializable;
45

5-
public record AuthorDto(Long id, String name, int age, List books) {
6+
public record AuthorDto(Long id, String name, int age, List books) implements Serializable {
67

78
public void addBook(BookDto book) {
89
books().add(book);

HibernateSpringBootDtoRecordJbcTemplate/src/main/java/com/bookstore/jdbcTemplate/dto/BookDto.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
import java.io.Serializable;
44

5-
public record BookDto(Long id, String title) {}
5+
public record BookDto(Long id, String title) implements Serializable {}

HibernateSpringBootDtoRecordJbcTemplate/src/main/resources/schema-mysql.sql

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
DROP TABLE IF EXISTS bookstoredb.book;
2+
DROP TABLE IF EXISTS bookstoredb.author;
3+
14
CREATE TABLE author (
25
id bigint(20) NOT NULL AUTO_INCREMENT,
36
age int(11) NOT NULL,

0 commit comments

Comments
 (0)