The Best Comments of August 2015

I think that the best part of writing a blog is to get comments from my readers.

Because I have learned a lot from my readers, I want to “reward” the best comments, help you to learn new things, and (hopefully) encourage people to leave more comments.

The rules are simple:

  • I select X best comments that were left on my blog during the previous month.
  • I link to these comments and explain why I chose them.
  • If the author of the selected comment has a blog, I add a link to her/his blog as well.

Enough with chit chat. The five best comments of August 2015 are (in chronological order):

The Five Best Comments of August 2015

Sankara asked if we can create a Spring Data JPA query method which uses the IN condition in a SQL query and deletes records from the database. I selected this question because it was fun to solve it, and I think that my answer is useful to other developers because it explains my solution to Sankara's problem.

Marcelo Paiva asked if the number of our inner classes can become a problem when we run our unit tests by using nested configuration. I chose this comment on this list because it points out the downside of using nested configuration:

If our class hierarchy sucks, so does our test class.

My answer describes the problems we can face when we use this approach and helps us to avoid / solve them.

Thorbs asked a very interesting question about the architecture of Spring web applications. He wanted to know how I create DTO objects from my entity objects, and he wanted to see an example that uses so called “flat” package hierarchy (functional packaging). This comment deserves to be on this list because I think that quite many developers are struggling to find the answers to these questions. Also, I think that my answer shed some light on this issue, but I would love to hear your opinion about this well.

Rob asked how he can use different UserDetailsManager bean when he runs integration tests. This comment earned a place on this list because this is a very common use case. My answer describes how he can solve his problem by using bean definition profiles.

Clement asked how he can create a Spring Data JPA query method that selects only a few properties of the managed entity. This is actually a quite common (and irritating) problem, and my answer explains two different ways to solve this problem.

1 comment… add one
  • Kishan Sep 10, 2015 @ 10:49

    Very good explanation and detailed for me to understand Spring JPA in an hour and implement the code. Would you be able take on Spring Data Rest with MySQL as database .and writing queries for aggregating data..there is hardly any posts on it on the web....Appreciate your work

    Kishan

Leave a Reply