• 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
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SimpleJdbcDaoSupport

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am extending SimpleJdbcDaoSupport in my Dao implementation and I have a question regarding linking tables i.e ManyToMany relationships. I have three tables: product category and category_product being the linking table that just holds the ID's of category and product tables.

So to insert a new product I would have to 1. insert the product details 2 retrive the Id of the newly inserted product 3 insert category id and product id into the category_product table. Is there a simple or recomended way of achieving this, short of calling getSimpleJdbcTemplate three times, or is a stored procedure the way to go? really appreciate any response you may have.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I were approaching this problem (and not using Hibernate) I think I'd make a transactional method that makes three separate calls.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic