I had a hard time to make my JUnit test working. Here are the code snippets. The first is my superclass:
Then there are two descendeants:
Here is an excerpt of the script, creating the DB in PostgreSQL:
And finally the test case^
The repo is
Now here is the log:
The question is: Why 190216.877 D main/JpaMealRepositoryImpl - m=null?
If I run this query in Postgres, replacing the ? with the meal_id (which is 4 as seen in the log), then I get a row. Just a single row as I wanted. Why em.find(...) returns null?
I fill the DB with the refill.sql script on start of each test-class:
Here is the qwery I issue in psql:
The result is
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
MS Windows 10
I'm attaching the ZIP with the test case, made according to the link you gave.
I have to state that the «BUG» doesn't reproduce on pure Hibrenate without Spring.
Frankly, I'm frustrated a bit now.
Find the attachment.
And thank you!
, are you saying that you're attached test case does not reproduce the issue?
@Gail Badner, yes, definitely. It looks like the Spring somehow influence Hibernate's working.
, it sounds like a Spring bug. Have you opened an issue with Spring?
@Gail Badner, yes, it does. No, I've not yet.