Skip to content

Commit

Permalink
#1 - disable db create-drop
Browse files Browse the repository at this point in the history
  • Loading branch information
obriensystems committed Mar 2, 2021
1 parent 5651c83 commit 4cebecb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/main/java/systems/eventstream/field/model/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ public class Event {

protected Event() {}

public Event(Long timestamp, String value, String label, String type, String category) {
this.timestamp = timestamp;
this.value = value;
this.label = label;
this.type = type;
this.category = category;
}

public Event(Long timestamp, String key, String value, String label, String type, String category) {
this.timestamp = timestamp;
this.key = key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ public List<Event> events() {
@Override
public void populate() {
// import rows
repository.save(new Event(System.nanoTime(), "1", "4", "new", "off", "category1"));
repository.save(new Event(System.nanoTime(), "4", "new", "off", "category1"));
try {
Thread.sleep(1);
} catch (Exception e) { }
repository.save(new Event(System.nanoTime(), "2", "5", "new", "time", "category2"));
repository.save(new Event(System.nanoTime(), "5", "new", "time", "category2"));
try {
Thread.sleep(1);
} catch (Exception e) { }
repository.save(new Event(System.nanoTime(), "3", "6", "done", "time", "category1"));
repository.save(new Event(System.nanoTime(), "6", "done", "time", "category1"));

log.info("Events found with findAll():");
log.info("-------------------------------");
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
# enable only on first startup
spring.jpa.hibernate.ddl-auto=create-drop

#spring.jpa.hibernate.ddl-auto=create-drop
#spring.jpa.hibernate.ddl-auto=create
spring.jpa.show-sql=true

0 comments on commit 4cebecb

Please sign in to comment.