• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

How to do mass updates on entity beans?

Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lets say I have a product database and each product has a catagory and discuount%. What I need to do is change the discount% of all the products of a category. I am thinking of having a home business method in the home interface: public void changeDiscount(String category, double newdiscount);
This method would then fire a query like: update product set discount=? where category=?
My question is: Is this a valid approach? Can I even specify such a query in the deployment descriptor? If I do that, what would happen to the discount values of the bean that are currently in use?
If this is not a valid approach, how should I update the discount value for each product?
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bob, shouldn't the percentage be held in the category? this would avoid mass updates (only 1 row updated in category instead).
If you wanted to do mass updates, I would have thought the best way would be to avoid entity beans, and use a DAO called by a session bean.
Ray Gill
No prison can hold Chairface Chippendale. And on a totally different topic ... my stuff:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic