From 0b29423ab073224ca9271963157ac0cc95335e52 Mon Sep 17 00:00:00 2001 From: ddangelorb Date: Wed, 27 Oct 2021 08:51:57 -0300 Subject: [PATCH] Fixing JPA Cache --- db/ddl.sql | 2 +- load/README.md | 2 +- .../wpdauth/model/EduCemadenOrganizations.java | 4 +++- .../org/waterproofingdata/wpdauth/service/UsersService.java | 5 ++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/db/ddl.sql b/db/ddl.sql index 212ec66..3857142 100644 --- a/db/ddl.sql +++ b/db/ddl.sql @@ -58,7 +58,7 @@ CREATE TABLE IF NOT EXISTS auth.users_provider_activationkey ( ); CREATE TABLE IF NOT EXISTS auth.educemaden_organizations ( - id INT NOT NULL, + id INT PRIMARY KEY, active VARCHAR(20) NULL, name VARCHAR(255) NOT NULL, creation_date varchar(50) NULL, diff --git a/load/README.md b/load/README.md index 204ab21..0bf4c8a 100644 --- a/load/README.md +++ b/load/README.md @@ -13,6 +13,6 @@ Once the project setup was finished successfully, follow the steps below: ```console $ psql -d wpdauth -c "TRUNCATE TABLE auth.educemaden_organizations;" - $ psql -d wpdauth -c "COPY auth.educemaden_organizations(id,active,name,creation_date,inep_code,phone,type,website,login,address,responsible) FROM '//educacao.cemaden-organization-dump.csv' DELIMITER ',' CSV HEADER;" + $ psql -d wpdauth -c "\COPY auth.educemaden_organizations(id,active,name,creation_date,inep_code,phone,type,website,login,address,responsible) FROM '//educacao.cemaden-organization-dump.csv' DELIMITER ',' CSV HEADER;" $ psql -d wpdauth -c "SELECT * FROM auth.educemaden_organizations;" ``` \ No newline at end of file diff --git a/src/main/java/org/waterproofingdata/wpdauth/model/EduCemadenOrganizations.java b/src/main/java/org/waterproofingdata/wpdauth/model/EduCemadenOrganizations.java index 58568d1..f264124 100644 --- a/src/main/java/org/waterproofingdata/wpdauth/model/EduCemadenOrganizations.java +++ b/src/main/java/org/waterproofingdata/wpdauth/model/EduCemadenOrganizations.java @@ -4,6 +4,7 @@ import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.GeneratedValue; import javax.persistence.Id; import lombok.Getter; @@ -16,6 +17,7 @@ import lombok.Setter; @NoArgsConstructor public class EduCemadenOrganizations { @Id + @GeneratedValue private Integer id; @Column(nullable = true) @@ -30,7 +32,7 @@ public class EduCemadenOrganizations { @Column(nullable = true) private String inep_code; - @Column(unique = true, nullable = false) + @Column(nullable = false) private String phone; @Column(nullable = true) diff --git a/src/main/java/org/waterproofingdata/wpdauth/service/UsersService.java b/src/main/java/org/waterproofingdata/wpdauth/service/UsersService.java index d5156c8..aa9f863 100644 --- a/src/main/java/org/waterproofingdata/wpdauth/service/UsersService.java +++ b/src/main/java/org/waterproofingdata/wpdauth/service/UsersService.java @@ -1,5 +1,7 @@ package org.waterproofingdata.wpdauth.service; +import java.util.List; +import java.util.Optional; import java.util.UUID; import javax.servlet.http.HttpServletRequest; @@ -187,11 +189,12 @@ public class UsersService { if (userAdmEducemadenOrganization == null) { return null; } + eduCemadenOrganizationsRepository.findAll(); return eduCemadenOrganizationsRepository.getById(userAdmEducemadenOrganization.getEducemadenorganizationsid()); } public UsersProviderActivationKey findProviderActivationKeyById(Integer usersid) { - return usersProviderActivationKeyRepository.findByUsersid(usersid); + return usersProviderActivationKeyRepository.findByUsersid(usersid); } public String refresh(String username) {