O'Reilly logo

Spring Persistence with Hibernate by Ahmad Seddighi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Integration testing data-access layer

When developing with Hibernate, we need to test whether the application's data-access layer works properly. This involves testing the following:

  • Whether classes are persistent
  • Whether all classes' fields are persistent
  • Whether HQL expressions return valid results
  • Whether persistent operations are cascaded as they are configured in the mapping definitions

Let's take the HibernateStudentDao class as a representation of the data-access layer and see how test cases are implemented for this class. The following code shows the StudentDao interface implemented by HibernateStudentDao:

package com.packtpub.springhibernate.ch15; import java.util.Collection; public interface StudentDao { public Collection getAllStudents(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required