Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

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
 
Roses are red, violets are blue. Some poems rhyme and some don't. And some poems are a tiny ad.
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!