How to obtain application property values in a Spring Boot application

How to obtain application property values in a Spring Boot application

In this guide, we will discuss two ways to obtain application property configuration values inside a Spring boot application. We will focus on properties that are loaded via an application.properties or an application.yml file. But all loaded properties in your application context should also be obtainable via the discussed methods. We will discuss the @Value […]

How to define and declare Spring beans using Java configuration and constructor injection

How to define and declare Spring beans using Java configuration and constructor injection

In this post, we will focus on configuring Spring beans in a Spring-boot environment using Java configuration and constructor injection. This example should be valid for Spring version 4.3 and later. Let us start by discussing a couple of basic concepts. What is constructor injection? Constructor injection is the process of injecting Spring dependencies into […]

Reasons why Hamcrest matchers are not so great for Java testing

Reasons why Hamcrest matchers are not so great for Java testing

Hamcrest matchers are great….. not!   When asked why use Hamcrest, developers usually site readability and ease of test writing among the most popular reasons for their choice. In this post, we will break down some of these reasons in order for you to make a better choice of frameworks. We will focus on Hamcrests […]

JPA / Hibernate PropertyNotFoundException – Troubleshooting and fixes

JPA / Hibernate PropertyNotFoundException – Troubleshooting and fixes

In this post, we discuss yet another reason for having a mapping error from Hibernate. This specific one is called a PropertyNotFoundException. If you have made sure that your property is correctly mapped to the database table, with correct column names and a getter and a setter for the property, then read on!. Let us […]

Java – Convert a decimal number to and from a binary number

Java – Convert a decimal number to and from a binary number

In this tutorial, we will discuss how to convert a decimal number to binary and back to a decimal. This can easily be done by preexisting Java functionalities. But for the sake of curiosity, let us implement our own algorithm first, and then let us discuss how to do with existing Java functions.   Algorithm […]

Java Modulus / Modulo operator – Examples and Uses

Java Modulus / Modulo operator – Examples and Uses

The Java modulus ‘%’ operator is one of numerous operators built into the Java programming language. The operator is used to calculate the remainder of the division between two numbers. First, let us discuss how the operator works. How to use the ‘%’ operator: The ‘%’ operator requires two operands. The first is the number […]

JPA / Hibernate – Mapping One-to-One relationships

JPA / Hibernate – Mapping One-to-One relationships

In this tutorial, we will discuss how to map and configure One-to-One relationships in JPA and Hibernate. What are One-To-One relationships? One to One relationships in databases define the relationship between two different entities, where the first entity can be related to zero or one of the second entity. For example, a user can have […]

How to manage JPA bidirectional relationships properly

How to manage JPA bidirectional relationships properly

In this troubleshooting guide, we will explore how to properly map bidirectional relationships and common mapping pitfalls that cause exceptions such as DataIntegrityViolationException, a ConstrainViolationException and a PropertyValueException. We will take an unusual approach in this guide by first building the faulty software, and then we will discuss how and why this should be fixed. […]

Configuring and mapping database tables to JPA entities

Configuring and mapping database tables to JPA entities

In this post, we will explore how to map a database tables to JPA Entities. In our example, we will use a Spring Boot environment, JPA 2.2 and Hibernate 5.3.7 . However, the information presented here should apply to any environment with a JPA version of 2.1 or later. Introduction In our previous post, we discovered […]

org.hibernate.MappingException: Could not determine type for: java.util.List – Causes & Fixes

org.hibernate.MappingException: Could not determine type for: java.util.List – Causes & Fixes

In this post, we will explore a very common Hibernate error, namely a MappingException caused by missing annotations on the Entity getters and fields. The error Let us check the following stack trace as an example:

: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested […]

We have been releasing new content since over a year now (yay!).

To improve our website, we would like to ask for your help filling out a short survey.

We only need 5 minutes of your time to tell us your opinion about our website. We will not ask for your email address!

Thank you very much!

Survey link: here