File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes How to do mass updates on entity beans? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Reply Bookmark "How to do mass updates on entity beans?" Watch "How to do mass updates on entity beans?" New topic
Author

How to do mass updates on entity beans?

Bob Walker Jr
Ranch Hand

Joined: Jun 02, 2003
Posts: 46
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?
Ramon Gill
Ranch Hand

Joined: May 15, 2003
Posts: 344
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
SCJP, SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to do mass updates on entity beans?
 
Similar Threads
Design Considerations for Save/Update
BODM / class diagram questions
IS NULL Test in PrepareStatement
loop inside loop with JSF
Abstract classes doubt