From 161e60ba315d092aeba2fee68a1b290e36c731e1 Mon Sep 17 00:00:00 2001 From: Leonardo de Souza Faria Date: Fri, 2 Nov 2018 22:31:07 -0300 Subject: [PATCH] Api funcionando com banco de dados Local --- .../java/br/com/mantendoofoco/DataConfiguration.java | 8 ++++---- .../br/com/mantendoofoco/MantendoOFocoApplication.java | 1 + src/main/java/br/com/mantendoofoco/model/Tarefa.java | 10 ++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/java/br/com/mantendoofoco/DataConfiguration.java b/src/main/java/br/com/mantendoofoco/DataConfiguration.java index 79c9394..abab7af 100644 --- a/src/main/java/br/com/mantendoofoco/DataConfiguration.java +++ b/src/main/java/br/com/mantendoofoco/DataConfiguration.java @@ -16,9 +16,9 @@ public class DataConfiguration { public DataSource dataSource(){ DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName("com.mysql.jdbc.Driver"); - dataSource.setUrl("jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/heroku_0bfd010abe48434"); - dataSource.setUsername("b3d900973edf84"); - dataSource.setPassword("1e258d22"); + dataSource.setUrl("jdbc:mysql://localhost:3306/mantendo-o-foco"); + dataSource.setUsername("root"); + dataSource.setPassword("root"); return dataSource; } @@ -28,7 +28,7 @@ public JpaVendorAdapter jpaVendorAdapter() { adapter.setDatabase(Database.MYSQL); adapter.setShowSql(true); adapter.setGenerateDdl(true); - adapter.setDatabasePlatform("org.hibernate.dialect.MySQLDialect"); + adapter.setDatabasePlatform("org.hibernate.dialect.MariaDBDialect"); adapter.setPrepareConnection(true); return adapter; } diff --git a/src/main/java/br/com/mantendoofoco/MantendoOFocoApplication.java b/src/main/java/br/com/mantendoofoco/MantendoOFocoApplication.java index 6a1f17f..3ebeb51 100644 --- a/src/main/java/br/com/mantendoofoco/MantendoOFocoApplication.java +++ b/src/main/java/br/com/mantendoofoco/MantendoOFocoApplication.java @@ -11,3 +11,4 @@ public static void main(String[] args) { SpringApplication.run(MantendoOFocoApplication.class, args); } } + diff --git a/src/main/java/br/com/mantendoofoco/model/Tarefa.java b/src/main/java/br/com/mantendoofoco/model/Tarefa.java index 61b5222..d42bd2e 100644 --- a/src/main/java/br/com/mantendoofoco/model/Tarefa.java +++ b/src/main/java/br/com/mantendoofoco/model/Tarefa.java @@ -24,8 +24,8 @@ public class Tarefa { private boolean status; - public Tarefa (long id, String descricao, int tempoPomodoro, int tempoPausaMenor, int tempoPausaMaior, int quantidadePomodoro, boolean status) { - this.setId(id); + public Tarefa ( String descricao, int tempoPomodoro, int tempoPausaMenor, int tempoPausaMaior, int quantidadePomodoro, boolean status) { + this.setDescricao(descricao); this.setTempoPomodoro(tempoPomodoro); this.setTempoPausaMenor(tempoPausaMenor); @@ -34,9 +34,7 @@ public Tarefa (long id, String descricao, int tempoPomodoro, int tempoPausaMenor this.setStatus(status); } - public void setId(long id) { - this.id = id; - } + public Tarefa() {}; public String getDescricao() { return descricao; @@ -78,7 +76,7 @@ public void setQuantidadePomodoro(int quantidadePomodoro) { this.quantidadePomodoro = quantidadePomodoro; } - public boolean isStatus() { + public boolean getStatus() { return status; }