Skip to content

Commit

Permalink
issue #33 comprobar inconsistencia con bbdd
Browse files Browse the repository at this point in the history
Ajuste en la bbdd para que no haga siempre create y drop
  • Loading branch information
Diego authored and Diego committed Jun 25, 2018
1 parent dfe9e25 commit 41f8ebb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ public void recieveIncidence(Incidence incidencia) {
}

agentsRepository.save(incidencia.getAgent()); // para evitar un problema de hibernate: 'save the transient instance before flushing'

assert(agentsRepository.exists(incidencia.getAgent().getId()));

incidencia.setOperario(operarios.get(op));
operarios.get(op).añadirIncidencia(incidencia);

incidencesRepository.save(incidencia); // meter incidencia en base de datos

assert(incidencesRepository.exists(incidencia.getId())); // tiene q estar si o si


logger.info("Incidencia: \"" + incidencia.getIncidenceName() + "\" asignada a: '" + incidencia.getOperario().getEmail() + "'");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ spring.datasource.url = jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=changeit
spring.datasource.driverClassName=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect

spring.cloud.stream.kafka.binder.zkNodes=localhost:2181
Expand Down

0 comments on commit 41f8ebb

Please sign in to comment.