Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Check out: Mapping JDBC Result set with annotation
 
Hey, I'm supposed to be the guide! Wait up! No fair! You have the tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic