Blog Archives

Part #3: JPA Hibernate Spring Maven Eclipse Tutorial – testing data access with HSQLDB

This tutorial focuses on testing data access logic with spring-test and hsqldb. This extends Part #2: JPA Hibernate Spring Maven Eclipse Tutorial – JPA configs and repository Testing the mapping of entities managed by hibernate and wiring up of JPA, Hibernate, etc via Spring. Schema and mock data similar to...

Members Only Content
Log In Register Home


Unit Test Hibernate – DAO Layer with JPA, Spring & HSQLDB

This post extends the previous one on “Unit Test Hibernate – DAO Layer with Spring & HSQLDB“. The changes are

1. Add “persistence-jpa.xml” to src/main/resources.

2. Modify the “entityManagerFactory()” method in the “SimpleConfig.java”.

Read more ›



Unit Test Hibernate – DAO Layer with Spring & HSQLDB

Step 1: The pom.xml file with test jars, Spring jars, and hibernate jars

Step 2: The HSQL DB schema and data scripts in the src/test/resources folder.

sql/schema.sql

sql/data.sql

Step 3: The Spring configuration for the unit tests in the src/test/java folder.

Read more ›



Unit Testing Data Access Logic in Java

Most interviewers like Java candidates those who are passionate and experienced about writing unit tests. Any non trivial Java application will be making calls to database tables. So, here are a few questions and answers testing your ability to write unit tests to test data access layer.

Q1.

Read more ›



800+ Java Interview Q&As Menu

Top