Hibernate One to Many Annotation Tutorial 1. Introduction This quick Hibernate tutorial will take us through an example of a one-to-many mapping using JPA annotations – an alternative to XML. We’ll also learn what bidirectional relationships are, how they can create inconsistencies, and how the idea of ownership can help. Further reading: Spring… Continue Reading hibernate-one-to-many

Using Spring ResponseEntity to Manipulate the HTTP Response 1. Introduction Using Spring, we usually have many ways to achieve the same goal, including fine-tuning HTTP responses. In this short tutorial, we’ll see how to set the body, status, and headers of an HTTP response using ResponseEntity. Further reading: Getting and… Continue Reading spring-response-entity

Jackson – JsonMappingException (No serializer found for class) 1. Overview In this quick tutorial, we will analyze the marshalling of entities with no getters and the solution for the Jackson JsonMappingException exception. If you want to dig deeper and learn other cool things you can do with the Jackson 2… Continue Reading jackson-jsonmappingexception

Criteria Queries Using JPA Metamodel 1. Overview In this tutorial, we’ll discuss how to use the JPA static metamodel classes while writing criteria queries in Hibernate. We’ll need a basic understanding of criteria query APIs in Hibernate, so please check out our tutorial on Criteria Queries for more information on this… Continue Reading hibernate-criteria-queries-metamodel

Hamcrest Common Core Matchers 1. Overview In this quick tutorial, we’ll explore the CoreMatchers class from the popular Hamcrest framework for writing simple and more expressive test cases. The idea is to make assert statements read like natural language. 2. Hamcrest Setup We can use Hamcrest with Maven by adding the following dependency to our pom.xml file:… Continue Reading hamcrest-core-matchers