I encountered a subtle hibernate mapping issue involving Dates and Timestamps. The following test recreates this issue.
» Read more: Hibernate Date vs Timestamp
Hibernate Logging
January 30th, 2012 by David Kessler 1 comment »Through the years I’ve encountered a recurring requirement. Clients need to log changes to the database for auditing and legal purposes. To satisfy this requirement you could add logging to every save/update/delete call in your code. Or better yet, you could create an aspect that wraps these calls. While these would certainly work Hibernate provides a convenient interceptor.
In this article I will show you how to add a simple logger to Hibernate.
» Read more: Hibernate Logging
Next Step in Agility
October 1st, 2011 by David Kessler 1 comment »I often find that teams that have adopted Agile practices quickly plateau. They often start by scheduling a daily stand up, planning in iterations, take time for a retrospective, and modify their estimation process. These are common first steps in the agile adoption process. Teams have varied success and commitments to these practices but nevertheless these are the low hanging fruits in the Agile adoption journey.
» Read more: Next Step in Agility
Learning a new Language
September 2nd, 2011 by David Kessler 1 comment »I attended a No Fluff Just Stuff Symposium a few weeks ago. One of the main emphasis during the weekend was learning new languages that are available on the JVM. While there are a variety of reasons that we need to take time to learn new programming languages, one of the most profound is learning to think about problems differently.
Paradigm Shift
When I entered the development scene I was immersed in Object Oriented programming. As a result, I tend to think of good design in objects. A few years ago I began to learn and apply Groovy. With closures I was able to bleed into the realm of Functional programming. This gave me a small taste of a new paradigm. I thought of new ways to solve problems that I couldn’t see with Java. I can only imagine how much more I could learn if I developed exclusively in a Functional language for several months.
» Read more: Learning a new Language
Spring Injection with @Resource, @Autowired and @Inject
August 1st, 2011 by David Kessler 4 comments »Overview
I’ve been asked several times to explain the difference between injecting Spring beans with ‘@Resource’, ‘@Autowired’, and ‘@Inject’. While I received a few opinions from colleagues and read a couple of posts on this topic I didn’t feel like I had a complete picture.
Annotations
| Annotation | Package | Source |
|---|---|---|
| @Resource | javax.annotation | Java |
| @Inject | javax.inject | Java |
| @Qualifier | javax.inject | Java |
| @Autowired | org.springframework.bean.factory | Spring |
In order to explore the behavior of each annotation I fired up Spring Tool Suite and started debugging the code. I used Spring 3.0.5.RELEASE in my research. The following is a summary of my findings.
» Read more: Spring Injection with @Resource, @Autowired and @Inject
Debugging memory leaks with VisualVM
July 18th, 2011 by Cory Wandling No comments »At work I had run into a memory leak when scrolling through large result sets returned from Hibernate. I thought I had fixed it by performing a evict()/clear()/flush() in the HibernateTemplate that I was using but suddenly the leak was back. I was using VisualVm to monitor the heap so I started poking around to see if there was anything to help diagnose where the leak was.
» Read more: Debugging memory leaks with VisualVM
Creating an Open Source Project
July 1st, 2011 by David Kessler No comments »Open Sourcing Software
I’ve been using open source software for many years, but I’ve never open sourced my own project. This blog is a record of my experience as I start this journey. The resulting project can be found at http://beanoh.org.
Where
First I had to decide where to store the code. There are several popular (Comparison of open source software hosting) open source hosting options. I chose GitHub (github.com) because I already had an account and I’m comfortable using Git. Furthermore, GitHub provides intuitive tools that make it easy to manage a project. I can setup an organization so multiple Source Allies employees can have commit rights on this project. GitHub also has an integrated issue and feature tracking system that connects commits with tickets. Overall I am very impressed with GitHub.
Maven 3 Tutorial – Project Setup
June 11th, 2011 by David Kessler 13 comments »- Overview
- What is Maven?
- Plugins
- Why not Ant and Ivy?
- But It Downloads the Internet
- Getting Started
- Install
- What is a POM?
- Convention over Configuration
- New Project
- Project Management
- Parent POM
- Local Maven Repository
- Multiple Artifacts from a Single Source
- Release Plugin
- Aggregate POM
- Dependency Management
- Distribution Zip
- Conclusions
Overview
What is Maven?
Maven is a software project management and comprehension tool that includes: build tools, dependency management, project reporting and much more. I say “much more” because at the core Maven is a plugin execution framework. There are plugins supported by the Maven project (http://maven.apache.org/plugins/index.html), plugins supported by Mojo Project (http://mojo.codehaus.org/plugins.html), and third party plugins. If you can find or write a plugin, Maven can run it.
» Read more: Maven 3 Tutorial – Project Setup
Testing Spring Wiring
June 1st, 2011 by David Kessler 2 comments »Overview
Spring is an essential part of my technology stack. I cann’t image providing quality software that doesn’t leverage an IoC container. However, decoupling components requires some amount of configuration. Whether this is accomplished through annotations or XML, it’s fairly easy to mess up. Fixing these missing or incorrect configurations doesn’t take very long. The real question is how quickly can you identify these errors?
This question of how long, is a feedback loop question. Unfortunately many teams wait until they fire up the application server to see if their Spring context is wired correctly. This is too late.
One of our clients suffered from this very issue. Due to environmental constraints they could not run automated, in-container tests that would have identified misconfigured beans. After repeatedly committing stupid configuration mistakes, I decided that I would write a Spring wiring test. As I began to write this I encountered five problems.
» Read more: Testing Spring Wiring
Mock Me With Fewer Words
May 1st, 2011 by David Kessler 1 comment »With Mockito 1.8.3 or higher you can significantly reduce your test code setup.
» Read more: Mock Me With Fewer Words