Commit 03a13c52 by Amparo Oliver

spring.jpa.hibernate.ddl-auto=update

parent 1740891f
...@@ -43,16 +43,24 @@ public class CurriculumsearchApplication { ...@@ -43,16 +43,24 @@ public class CurriculumsearchApplication {
guardarJson(ciudR,"/json/Ciudad.json",Ciudad.class); guardarJson(ciudR,"/json/Ciudad.json",Ciudad.class);
guardarJson(tecRepo,"/json/tecnologia.json",Tecnologia.class); guardarJson(tecRepo,"/json/tecnologia.json",Tecnologia.class);
guardarJson(insR,"/json/institucion.json",Institucion.class); guardarJson(insR,"/json/institucion.json",Institucion.class);
guardarJson(postRepo,"/json/postulante.json",Postulante.class); //guardarJson(postRepo,"/json/postulante.json",Postulante.class);
String password = new BCryptPasswordEncoder().encode("test"); String password = new BCryptPasswordEncoder().encode("test");
RRHHUser testuser = new RRHHUser(); String testEmail = "test@test.com";
testuser.setEmail("test@test.com");
testuser.setFirstName("test"); // Check if the user with the email already exists before saving
testuser.setLastName("test"); RRHHUser existingUser = rrhhUserRepository.findByEmail(testEmail);
testuser.setPassword(password); if (existingUser == null) {
rrhhUserRepository.save(testuser); RRHHUser testuser = new RRHHUser();
System.out.println("Usuario Test: \nEmail: test@test.com\nPassword: test"); testuser.setEmail(testEmail);
testuser.setFirstName("test");
testuser.setLastName("test");
testuser.setPassword(password);
rrhhUserRepository.save(testuser);
System.out.println("Usuario Test: \nEmail: " + testEmail + "\nPassword: test");
} else {
System.out.println("User with email " + testEmail + " already exists.");
}
} catch (IOException e){ } catch (IOException e){
System.out.println("Unable to save: " + e.getMessage()); System.out.println("Unable to save: " + e.getMessage());
......
spring.jpa.hibernate.ddl-auto=create-drop spring.jpa.hibernate.ddl-auto=update
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
#spring.jpa.show-sql=true #spring.jpa.show-sql=true
#spring.jpa.properties.hibernate.format_sql=true #spring.jpa.properties.hibernate.format_sql=true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment