title: Spring JDBC RowMapper with Class Hierarchies
body: <p>I wanted to know what the community considers the "best practices" in respect to mapping class hierarchies with Spring JDBC.  </p>
  
  <p>We do not have the ability to use a full fledged ORM tool, however we are using the Spring JDBC to alleviate some of the tedious nature of JDBC.  One class which we leverage very regularly are the BeanPropertyRowMapper for it's ease of use and the ability to have type insensitive bean property access from our result set. </p>
  
  <p>I have a class hierarchy that all maps back to a single table (taking the table-per-hiearchy approach for this small class hierarchy).  As such, the table contains an classId column which can be used to determine what class should actually be instantiated.  Ex. 1 = Manager, 2 = Employee, 3 = Contractor.  All of these are "People" but each subclass of person has a few attributes which are unique to their class.  </p>
  
  <p>My initial thought is to create a subclass of BeanPropertyRowMapper and try and inject this logic to say "if column A = 1 then instantiate a Manager and then do your nomral binding".  </p>
  
  <p>Does this seem like a reasonable approach?  Are there any other suggestions people may have that have worked for you?</p>