• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Spring-Jdbc

 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you please let me know on the below.
I have 15 database tables with corresponding java classes from which I need to pull data and show it to the REST client. We are using spring-jdbc without any ORM..
I am using BeanPropertyRowmapper to map the database values with the corresponding variables defined in java classes.
As a result there will be 15 Database hits..
I know its a bad practise and performance hit. could you suggest me..(only spring-jdbc i should use)
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't you view table( consolidating the 15 tables columns to one table) and pull data from there?
 
author & internet detective
Posts: 41502
881
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are able to a join, you can JDBC Template's query method to retrieve all the data in one shot. If your rows aren't one to one, that results in a lot of extra network usage (bandwidth though.) So you are trading data transfer for network connections. I wouldn't recommend this.

Do you need to get 15 tables each time? It seems likely some of these are static tables that you can get once and then cache.
 
dileep keely
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne,
I need to interact with all those 15 tables out of 19tables , I am already loading the other 4 tables which are static during the run time.
I can join some of the tables but the problem is that we need to map them to the nested classes.
I have wrote a custom mapper by extending the beanpropertyrowmapper. BUt not sure to what extent it could help me. I am going
to try that tomorrow.
 
reply
    Bookmark Topic Watch Topic
  • New Topic