diff --git a/persistence-modules/spring-boot-persistence-h2/pom.xml b/persistence-modules/spring-boot-persistence-h2/pom.xml
index 30c727bfc8..d1fd5b0170 100644
--- a/persistence-modules/spring-boot-persistence-h2/pom.xml
+++ b/persistence-modules/spring-boot-persistence-h2/pom.xml
@@ -22,6 +22,10 @@
org.springframework.boot
spring-boot-starter-data-jpa
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
com.h2database
h2
diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/java/com/baeldung/h2db/springboot/daos/ItemRepository.java b/persistence-modules/spring-boot-persistence-h2/src/main/java/com/baeldung/h2db/springboot/daos/ItemRepository.java
new file mode 100644
index 0000000000..3007f56208
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-h2/src/main/java/com/baeldung/h2db/springboot/daos/ItemRepository.java
@@ -0,0 +1,9 @@
+package com.baeldung.h2db.springboot.daos;
+
+import com.baeldung.h2db.springboot.models.Item;
+import org.springframework.data.repository.CrudRepository;
+
+import java.math.BigDecimal;
+
+public interface ItemRepository extends CrudRepository- {
+}
diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/java/com/baeldung/h2db/springboot/models/Item.java b/persistence-modules/spring-boot-persistence-h2/src/main/java/com/baeldung/h2db/springboot/models/Item.java
new file mode 100644
index 0000000000..a5c5b0d3cb
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-h2/src/main/java/com/baeldung/h2db/springboot/models/Item.java
@@ -0,0 +1,18 @@
+package com.baeldung.h2db.springboot.models;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+@Entity
+public class Item {
+
+ @Id
+ @GeneratedValue
+ private Long id;
+
+ @NotNull
+ private BigDecimal price;
+}
diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.properties b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.properties
index 109b389b58..ed1ffc63c3 100644
--- a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.properties
+++ b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.properties
@@ -3,6 +3,10 @@ spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.hibernate.ddl-auto=create-drop
+spring.jpa.show-sql=true
+spring.jpa.properties.hibernate.format_sql=true
+spring.jpa.properties.hibernate.validator.apply_to_ddl=false
+#spring.jpa.properties.hibernate.check_nullability=true
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
debug=true
\ No newline at end of file
diff --git a/persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/ItemIntegrationTest.java b/persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/ItemIntegrationTest.java
new file mode 100644
index 0000000000..839dd87b7e
--- /dev/null
+++ b/persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/ItemIntegrationTest.java
@@ -0,0 +1,29 @@
+package com.baeldung;
+
+import com.baeldung.h2db.springboot.SpringBootH2Application;
+import com.baeldung.h2db.springboot.daos.ItemRepository;
+import com.baeldung.h2db.springboot.models.Item;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.validation.ConstraintViolationException;
+
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringBootH2Application.class)
+public class ItemIntegrationTest {
+
+ @Autowired
+ private ItemRepository itemRepository;
+
+ @Test
+ public void shouldNotAllowToPersistNullItemsPrice() {
+ assertThatThrownBy(() -> itemRepository.save(new Item()))
+ .hasRootCauseInstanceOf(ConstraintViolationException.class)
+ .hasStackTraceContaining("must not be null");
+ }
+}