Skip to main content

All Questions

Tagged with
-1 votes
1 answer
39 views

In my Spring setup with DbSetUp + H2 database, queries with LIKE are not working

As the title suggests, what I want to do is test a class with database access in a Spring Boot application. In the target class, I am using Specification as follows: TestSpecification specification = ...
harunaga's user avatar
  • 355
0 votes
1 answer
218 views

Why does SELECT VERSION FROM BATCH_JOB_EXECUTION WHERE JOB_EXECUTION_ID=? returns nothing?

I am testing a spring batch application witht he help of the Spring batch testing. I have created the tables that the spring batch test use manually in the h2 database. However when test launching a ...
Jeet_dev's user avatar
0 votes
0 answers
78 views

How to resolve the configuration problem with 2 application.properties in Springboot?

I have 2 application.properties in a Springboot project. One for the test(application) and the other for the application. I dont understand the log here which is eventually throwing an error of not ...
Jeet's user avatar
  • 395
0 votes
1 answer
682 views

How can I see any table when I run any test method through JUnit in Spring Boot through H2 Database

I generally use h2 database for testing the app through JUnit without running the app. When I run any test method of controller,service or repository, I cannot see any table generated. Here is the ...
S.N's user avatar
  • 1
0 votes
2 answers
648 views

Why aren't rows being inserted into the H2 Db from my script even though the drop table and create table is happening?

Why aren't rows being inserted into the H2 Db from my script even though the drop table and create table is happening? Hibernate: drop table if exists encouragement CASCADE Hibernate: create table ...
likejudo's user avatar
  • 3,574
-2 votes
1 answer
724 views

Unable to run JUnit test of JPA Repository with H2 database - why is no data returned?

Update: somehow the data is not being inserted. the drop table and create table is executed but not the insert rows. I moved data.sql to src/test/resources/ I am testing my SpringBoot application ...
likejudo's user avatar
  • 3,574
0 votes
2 answers
1k views

PostgreSQL function not existing in H2 causes InvalidDataAccessResourceUsageException on repository tests in Spring Boot

I have a repository class that includes functions with native PostgreSQL queries. Queries are all alike and have the same fashion with below one. @Repository public interface MyEntityRepository ...
gsan's user avatar
  • 573
0 votes
1 answer
853 views

org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet;

I am writing a unit test for a custom query in my repository in Spring. I am using an h2 in-memory database to create an employee and perform an assertion on that employee which should be returned ...
Matthew Lindow's user avatar
2 votes
1 answer
520 views

Customize H2 parameters if I want AutoConfigureTestDatabase to create a new connection for each test

In a Spring Boot (2.1.3) project, I try to run an integration test against a memory H2 database (2.1.210). I also insert some data in Spring's data.sql. I annotated the tests with @...
user3429660's user avatar
  • 2,610
0 votes
2 answers
548 views

I can't test on a test database during my integration tests

I would like to do some integration tests. These tests would then use a h2 test database, which would always be deleted afterwards. Here is my test: @SpringBootTest() public class PostePomponServiceIT{...
user avatar
0 votes
0 answers
378 views

h2 : NULL not allowed for column "modified"; SQL statement

I have upgraded spring boot h2 to 2.1.210 from 1.4.199. My tests are failing because of following error: NULL not allowed for column "modified" But in the create table DLL for h2, its ...
user124's user avatar
  • 433
0 votes
1 answer
440 views

How h2 works in springboot test cases

I am using springboot and H2 database for test cases. I have multiple test classes each annotated with @SpringBootTest. Each class has multiple test methods annotated with @Test My doubt is, will h2 ...
Vishnupriya's user avatar
1 vote
0 answers
628 views

Spring boot: H2 test database don't recognize "serial4"

I'm using h2 as in memory in order to test a spring repository class. But when h2 try to create the table return: org.h2.jdbc.JdbcSQLNonTransientException: Unknown data type: "SERIAL4"; The ...
mttpc's user avatar
  • 11
0 votes
1 answer
3k views

H2 database with Multiple Test Classes in SpringBoot

In my SpringBoot application, I have one test classes inside /src/test/java. For Testing (Unit Tests). I want to use the In memory H2 database. I have the following Database Url jdbc:h2:mem:test;...
Abdul Mohsin's user avatar
  • 1,405
1 vote
1 answer
4k views

Not able to run Junit test with H2 database SpringBoot

I have a strange problem with my unit test.. My goal is to run test on a H2 database and not on my Mysql database.. Actually the strange thing is that when i click on maven test it runs the app, ...
Kévin's user avatar
  • 527

15 30 50 per page