diff options
author | Santo Cariotti <santo@dcariotti.me> | 2022-01-24 19:34:43 +0100 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2022-01-24 19:34:43 +0100 |
commit | be0b89e3ce73018e1fb437905e1cf26bf26a9927 (patch) | |
tree | 417339db63dda995e64803b1d3867ffa481248c2 /Year_3/TSDWL/SPRING/bank/bookstore/src/main | |
parent | 710f54c0156c5fa081bc6af1a68e7cb44723939b (diff) |
add example in spring
Diffstat (limited to 'Year_3/TSDWL/SPRING/bank/bookstore/src/main')
3 files changed, 89 insertions, 0 deletions
diff --git a/Year_3/TSDWL/SPRING/bank/bookstore/src/main/java/it/dmi/exam/bookstore/Book.java b/Year_3/TSDWL/SPRING/bank/bookstore/src/main/java/it/dmi/exam/bookstore/Book.java new file mode 100644 index 0000000..c5b6312 --- /dev/null +++ b/Year_3/TSDWL/SPRING/bank/bookstore/src/main/java/it/dmi/exam/bookstore/Book.java @@ -0,0 +1,69 @@ +package it.dmi.exam.bookstore; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +import org.springframework.lang.Nullable; + +@Entity +public class Book { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column + private String name; + + @Column + private String description; + + @Nullable + private String body; + + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; + } + + public Book() { + } + + public Book(Long id, String name, String description, String body) { + this.id = id; + this.name = name; + this.description = description; + this.body = body; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +}
\ No newline at end of file diff --git a/Year_3/TSDWL/SPRING/bank/bookstore/src/main/java/it/dmi/exam/bookstore/BookstoreApplication.java b/Year_3/TSDWL/SPRING/bank/bookstore/src/main/java/it/dmi/exam/bookstore/BookstoreApplication.java new file mode 100644 index 0000000..2859579 --- /dev/null +++ b/Year_3/TSDWL/SPRING/bank/bookstore/src/main/java/it/dmi/exam/bookstore/BookstoreApplication.java @@ -0,0 +1,13 @@ +package it.dmi.exam.bookstore; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class BookstoreApplication { + + public static void main(String[] args) { + SpringApplication.run(BookstoreApplication.class, args); + } + +} diff --git a/Year_3/TSDWL/SPRING/bank/bookstore/src/main/resources/application.properties b/Year_3/TSDWL/SPRING/bank/bookstore/src/main/resources/application.properties new file mode 100644 index 0000000..30a59b8 --- /dev/null +++ b/Year_3/TSDWL/SPRING/bank/bookstore/src/main/resources/application.properties @@ -0,0 +1,7 @@ +#server.port=3000 + +spring.datasource.url=jdbc:mysql://localhost:3307/sp?serverTimezone=Europe/Rome +spring.datasource.username=root +spring.datasource.password=pass +spring.jpa.hibernate.ddl-auto=update +spring.datasource.initialization-mode=always |