All Questions
571
questions
0
votes
1
answer
46
views
Trouble configuring persistence provider with JPA / Hibernate
I'm trying to write JUnit tests for my company's application. For some reason hibernate isn't discovering my @Entity classes. The application works normally so I know the entity classes are annotated ...
0
votes
0
answers
28
views
How do I get hibernate to scan for entities in my main application, from the testing configuration?
I am writing unit tests for my company application with JUnit. My application uses hibernate via the JPA EntityManager interface. I'm trying to configure a hibernate session to inject while testing. ...
0
votes
0
answers
52
views
How to capture SQL queries executed using Hibernate during a session and save them to a string array
I get an empty array when try to get Sql queries using
Statistics statistics = sessionFactory.getStatistics();
String[] queries = statistics.getQueries();
Need to make a test that checks for the ...
0
votes
1
answer
256
views
Cleaning db entities after test
I'm writing an autotest(with java maven+junit+cucumber)
Before the start of testcase I need to create a user for test and some entities in db(lets name them entity1 and entity2)
During the testcase I ...
0
votes
2
answers
102
views
Fail in JUnit Duplicate Test
I'm learning about JUnit Test in Java, I'm currently doing the duplicate phone number test when adding an object with a duplicate phone number to the database.
From what I learn, I will use ...
2
votes
1
answer
94
views
Unit testing does not get attributes
I want to test (values that are definitely inside my database (I see these values when i am debugging))
I want to get get a list of strings from an linkedArrayList with a LinkedHashMap inside it (...
0
votes
2
answers
651
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 ...
1
vote
0
answers
223
views
junit test fails : data jpa query not working with H2 database
I'am using micronaut data jpa and the query works fine with oracle but not with H2 database.
here is the query :
delete from myTable
where (some conditions)
AND (to_char(startDate, 'DY', '...
0
votes
1
answer
262
views
junit duplicate key, but first three times
I run junit tests, with almost the same configuration like main project, in postgres like a main project but on separate test db. Every run i insert prepared data for test.
https://i.sstatic.net/tlb92....
1
vote
3
answers
979
views
JUnit test is with inconsistent data during findAll and findById
I'm trying to test the repository layer of a user implementing JpaRepository having the following test class:
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import ...
0
votes
1
answer
421
views
Why is my mocked repository trying to connect to the database?
So I'm trying to unittest the servicelayer of my "RESTful-like" API (RESTful-like because I'm not using Springboot or any other framework and instead try to code it from scratch...).
The big ...
0
votes
1
answer
219
views
Testing JdbcSQLIntegrityConstraintViolationException on repository layer
I have the following Entity:
@Data
@Entity
@Table(name = DbConstants.TBL_REVIEWS, schema = DbConstants.SCHEMA_PUBLIC)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Review {
@Id
...
0
votes
2
answers
4k
views
Using Hibernate 6 with JPA
Based on new information, I am rephrasing my question, keeping the original text below for reference:
When switching to Hibernate 6, I got requirements for new packages to include. I do not understand ...
0
votes
1
answer
341
views
Spring data JPA Junit tests work apart but don't work together
I'm going to test my app with next Junit tests:
@DataJpaTest
class UserNameTest {
@Autowired
private UserNameRepo repo;
private UserName userName;
@Test
public void createUserName(...
0
votes
0
answers
138
views
Why is Hibernate working in production but not during tests?
Here is my PersistanceConfiguration from my Spring Boot app.
@Configuration
@EnableAspectJAutoProxy
@EnableTransactionManagement
@EnableJpaRepositories(basePackages = {"org.persistence.repository&...