Browse Source

Fixing JPA Cache

main
ddangelorb 3 years ago
parent
commit
0b29423ab0
  1. 2
      db/ddl.sql
  2. 2
      load/README.md
  3. 4
      src/main/java/org/waterproofingdata/wpdauth/model/EduCemadenOrganizations.java
  4. 5
      src/main/java/org/waterproofingdata/wpdauth/service/UsersService.java

2
db/ddl.sql

@ -58,7 +58,7 @@ CREATE TABLE IF NOT EXISTS auth.users_provider_activationkey (
); );
CREATE TABLE IF NOT EXISTS auth.educemaden_organizations ( CREATE TABLE IF NOT EXISTS auth.educemaden_organizations (
id INT NOT NULL,
id INT PRIMARY KEY,
active VARCHAR(20) NULL, active VARCHAR(20) NULL,
name VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL,
creation_date varchar(50) NULL, creation_date varchar(50) NULL,

2
load/README.md

@ -13,6 +13,6 @@ Once the project setup was finished successfully, follow the steps below:
```console ```console
$ psql -d wpdauth -c "TRUNCATE TABLE auth.educemaden_organizations;" $ 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 '/<absolute path>/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 '/<absolute path>/educacao.cemaden-organization-dump.csv' DELIMITER ',' CSV HEADER;"
$ psql -d wpdauth -c "SELECT * FROM auth.educemaden_organizations;" $ psql -d wpdauth -c "SELECT * FROM auth.educemaden_organizations;"
``` ```

4
src/main/java/org/waterproofingdata/wpdauth/model/EduCemadenOrganizations.java

@ -4,6 +4,7 @@ import java.util.UUID;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import lombok.Getter; import lombok.Getter;
@ -16,6 +17,7 @@ import lombok.Setter;
@NoArgsConstructor @NoArgsConstructor
public class EduCemadenOrganizations { public class EduCemadenOrganizations {
@Id @Id
@GeneratedValue
private Integer id; private Integer id;
@Column(nullable = true) @Column(nullable = true)
@ -30,7 +32,7 @@ public class EduCemadenOrganizations {
@Column(nullable = true) @Column(nullable = true)
private String inep_code; private String inep_code;
@Column(unique = true, nullable = false)
@Column(nullable = false)
private String phone; private String phone;
@Column(nullable = true) @Column(nullable = true)

5
src/main/java/org/waterproofingdata/wpdauth/service/UsersService.java

@ -1,5 +1,7 @@
package org.waterproofingdata.wpdauth.service; package org.waterproofingdata.wpdauth.service;
import java.util.List;
import java.util.Optional;
import java.util.UUID; import java.util.UUID;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -187,11 +189,12 @@ public class UsersService {
if (userAdmEducemadenOrganization == null) { if (userAdmEducemadenOrganization == null) {
return null; return null;
} }
eduCemadenOrganizationsRepository.findAll();
return eduCemadenOrganizationsRepository.getById(userAdmEducemadenOrganization.getEducemadenorganizationsid()); return eduCemadenOrganizationsRepository.getById(userAdmEducemadenOrganization.getEducemadenorganizationsid());
} }
public UsersProviderActivationKey findProviderActivationKeyById(Integer usersid) { public UsersProviderActivationKey findProviderActivationKeyById(Integer usersid) {
return usersProviderActivationKeyRepository.findByUsersid(usersid);
return usersProviderActivationKeyRepository.findByUsersid(usersid);
} }
public String refresh(String username) { public String refresh(String username) {

Loading…
Cancel
Save