Blog Insights
  • development icon

    Hibernate Date vs Timestamp

    I encountered a subtle hibernate mapping issue involving Dates and Timestamps. The following test recreates this issue. package com.sourceallies.logging; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.sql.Timestamp; import java.util.Calendar; import java.util.Date; import java.util.List; import javax.annotation.Resource; import org.apache.commons.lang.time.DateUtils; import org.hibernate.Criteria; import org.hibernate.SessionFactory; import org.hibernate.classic.Session; import org.junit.Before; import org.junit.Test;...
  • development icon

    Hibernate Logging

    Through the years I’ve encountered a recurring requirement. Partners 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...
  • development icon

    Back to Basics: hashCode() & equals()

    So we all know that if we implement equals() we must override hashCode() too. But why? The best explanation of this commandment can be found in Effective Java (2nd Edition) starting on page 45. ... Failure to do so will result in a violation of the general contract for Object.hashCode,...
  • agile icon

    Next Step in Agility

    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...
  • development icon

    Learning a new Language

    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...
  • development icon

    Spring Injection with @Resource, @Autowired and @Inject

    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...
  • development icon

    Debugging memory leaks with VisualVM

    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...
  • development icon

    Creating an Open Source Project

    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...
  • development icon

    Maven 3 Tutorial - Project Setup

    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...
  • testing icon

    Testing Spring Wiring

    Overview Spring is an essential part of my technology stack. I can’t imagine 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...