Home » Author Archives: Michal Jastak

Author Archives: Michal Jastak

Michał is a Chief Technology Officer in Java Division of AIS.PL, company developing mostly Web Applications of different kind, usually e-Government related.

Serialization Proxy Pattern example


There are books, which change your life immensely. One of such books is “Effective Java” by Joshua Bloch. Below you may find small experiment, which was inspired by Chapter 11 of this book – “Serialization”. Suppose that we have a class designed for inheritance, which is not Serializable itself, and has no parameterless constructor, like in this example:     ...

Read More »

JPA – Querydsl Projections


In my last post: JPA – Basic Projections – I’ve mentioned about two basic possibilities of building JPA Projections. This post brings you more examples, this time based on Querydsl framework. Note, that I’m referring Querydsl version 3.1.1 here. Reinvented constructor expressions Take a look at the following code:         ... import static com.blogspot.vardlokkur.domain.QEmployee.employee; import javax.persistence.EntityManager; import ...

Read More »

JPA – Should I become a laziness extremist?


When you spoke with the Developers about mapping objects to relational databases, they very often complain about poor JPA performance, unpredictable behavior of JPA Providers, etc. Usually at some point of the conversation you will hear: “Let’s drop this technology at all, we’ve seen something much better on the conference last month. We will use it in our projects instead ...

Read More »

JPA – Hibernate – Type mapping on package level


When we are finally mature enough to use some custom types mapping in JPA, we usually stuck with some provider specific solution, because JPA itself doesn’t define any mechanism for doing it. Let me show you an example of custom type mapping definition for one of the JPA providers – Hibernate. Suppose that we use Joda Money in our project, ...

Read More »

Spring’s Web MVC – Redirect to the Memory Leak


They say that one rock can cause an avalanche. Lately, one of my Colleagues, Marcin Radoszewski, gave me such a rock. You’ll probably never guess what it is, but there is a chance, that you use it in many of your Web Applications. Allow me to introduce this rock to you. You probably well know redirect after post pattern. Using ...

Read More »

Customize PMD in Eclipse with your own rules


PMD is very nice Java code scanner which helps you avoid potential programming problems. It can be easily extended to your needs, and this post will bring you simple example of custom PMD rules related to JPA’s @Enumerated annotation usage. Before you’ll continue the reading, you should check one of my previous posts – JPA – @Enumerated default attribute. When ...

Read More »

JSON – Jackson to the rescue


Sometimes you have to fetch some data from the server in JavaScript, JSON is pretty good choice for this task. Let’s play with the Employer – Employee – Benefit example from the post JPA Demystified (episode 1) – @OneToMany and @ManyToOne mappings. We will use it inside the web application based on Spring Framework. Our first controller will return the ...

Read More »

FindBugs and JSR-305


Suppose that group of developers work in parallel on parts of big project – some developers are working on service implementation, while others are working on code using this service. Both groups agreed on service API, and started working separately, having in mind the API assumptions… Do you think this story will have happy end? Well, … – maybe :) ...

Read More »

Spring MVC – Flash Attributes


Latest Spring Framework incarnation (3.1) brought interesting feature called Flash Attributes. It is remedy for the problem mentioned a long time ago, in one of my posts: Spring MVC – Session Attributes handling. This problem can be described in few words: if we want to pass the attributes via redirect between two controllers, we cannot use request attributes (they will ...

Read More »

Spring Insight – Web Application Profiling


Are you writing Web Applications using Spring Framework? Have you ever thought what’s going on under the hood? Why your application is responding so slowly? Why the snail outside your window is disappearing in the distance so fast while you still wait for your application response? You should :) and the Spring Insight can be very helpful with this task. ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.