Author Archives: Robert Piasecki

About Robert Piasecki

Husband and father, Java software developer, Linux and open-source fan.

Custom bean validation constraints

Bean Validation API defines several built-in constraint annotations which are very useful in many situations. However, there are still some cases where these standard constraints are not enough and you have to create your own custom constraint. With Bean Validation … Continue reading

Posted in Java, Java EE, Spring | Tagged , , , | 4 Comments

Common exception misuses in Java (and not only)

Exceptions were introduced in many programming languages as a standard method to report and handle errors. If you have ever used functions that return special values (usually -1 or NULL) to indicate an error, you should know how easy it is … Continue reading

Posted in Java, Software development practices | Tagged , | 7 Comments

Views in Java Collections Framework

View in Java Collections Framework is a lightweight object which implements Collection or Map interface but is not a real collection in a traditional sense. In fact, view does store objects inside but references another collection, array or a single … Continue reading

Posted in Java | Tagged , | 1 Comment

Validating HTML forms in Spring using Bean Validation

Validating input is a crucial part to ensure data integrity and proper function of the whole application. JSR-303 also known as Bean Validation is a very convenient way to perform such validation at different levels of the application. In this … Continue reading

Posted in Java, Spring | Tagged , , | 4 Comments

Using JPA and JTA with Spring

When building a web application, we will sooner or later need to somehow store data entered by users and retrieve it later. In most cases the best place to keep this data is a database because it additionally provides many … Continue reading

Posted in Java, Java EE, JPA, JTA, Spring | Tagged , , , , , , | 15 Comments

Git: how to use tags

Tagging is a very popular and common concept in version control systems. Tags are generally used to mark special milestones in a history of your repository like releasing a new version of your product. The common practice is to create … Continue reading

Posted in cryptography, Git, Version control | Tagged , | 2 Comments

How to handle HTML forms in Spring

Spring MVC is a part of Spring Framework which main purpose is to simplify development of web applications. In this article I would like to explain how to handle HTTP requests, render the web page and process simple HTML forms … Continue reading

Posted in Java, Spring | Tagged , , , , , , | 6 Comments

Git: how to resolve merge conflicts

When working in several people on the same part of code, you will sooner or later end up having merge conflicts. At first merge conflict may seem overwhelming but once you resolve few of them, they will cease to be … Continue reading

Posted in Git, Version control | Tagged , | 8 Comments

Recursively walking directory using Java NIO

Sometimes you may need to recursively visit all files and subdirectories of given directory and perform some actions on it. The typical use case is searching files of a given type, copying or removing a directory including all its contents. … Continue reading

Posted in Java | Tagged , , | 4 Comments

Calculating cryptographic hash functions in Java

Cryptographic hash function is an algorithm which takes block of data of arbitrary length as an input and outputs a short fixed-length sequence of bits (usually 128-512 bits) and which ideally should have following properties: it is very easy to … Continue reading

Posted in cryptography, Java | Tagged , , , , | Leave a comment