From 43feef5b42e2d11b27cd87706ed828bb60dee46e Mon Sep 17 00:00:00 2001 From: Loredana Date: Thu, 15 Oct 2020 19:03:52 +0300 Subject: [PATCH] add indexes to jpa entities --- testing-modules/load-testing-comparison/pom.xml | 2 -- .../baeldung/loadtesting/model/CustomerRewardsAccount.java | 3 +++ .../main/java/com/baeldung/loadtesting/model/Transaction.java | 4 ++++ .../src/main/resources/application.properties | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/testing-modules/load-testing-comparison/pom.xml b/testing-modules/load-testing-comparison/pom.xml index 55e94379db..4c237aeb75 100644 --- a/testing-modules/load-testing-comparison/pom.xml +++ b/testing-modules/load-testing-comparison/pom.xml @@ -37,7 +37,6 @@ com.fasterxml.jackson.core jackson-databind - ${jackson.version} org.springframework.boot @@ -72,7 +71,6 @@ org.springframework.boot spring-boot-maven-plugin - 2.0.5.RELEASE diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java index 0599020700..4d92c93fcb 100644 --- a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java +++ b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java @@ -4,8 +4,11 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +import javax.persistence.Index; +import javax.persistence.Table; @Entity +@Table(indexes = {@Index(columnList="customerId")}) public class CustomerRewardsAccount { @Id diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java index 1a6e0d4360..6e2fb39cc6 100644 --- a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java +++ b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java @@ -4,10 +4,14 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +import javax.persistence.Index; +import javax.persistence.Table; + import java.util.Date; import java.util.Calendar; @Entity +@Table(indexes = {@Index(columnList="customerRewardsId")}) public class Transaction { @Id diff --git a/testing-modules/load-testing-comparison/src/main/resources/application.properties b/testing-modules/load-testing-comparison/src/main/resources/application.properties index 424d3d0290..e2c8cb1879 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/application.properties +++ b/testing-modules/load-testing-comparison/src/main/resources/application.properties @@ -2,6 +2,6 @@ spring.h2.console.enabled=true spring.datasource.url=jdbc:h2:mem:testdb spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa -spring.datasource.password=password +spring.datasource.password= spring.jpa.database-platform=org.hibernate.dialect.H2Dialect