• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Spring JDBC Template with annotation-based bean property/column name mapping?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When using JPA you get the ability to use annotations to specify the mappings between beans/properties and tables/columns. However, for my application JPA is overkill, so I'm using Spring's JDBCTemplate capabilities.

With Spring's SimpleJdbcInsert (for example), the framework can match column names to property names for you, but ONLY if the column names match the property names exactly.

I have a database with underscore-delimited column names that match camel-case bean property names. What I want to do is specify this correspondence as annotation. Ideally it would look something like this:



I spent several hours searching the web yesterday but didn't find anything. I'd rather not write boilerplate mapping code if it can be done with annotations.

Does anything exist that works with plain JDBC templates?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out: Mapping JDBC Result set with annotation
 
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic