• 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

Multiple Updates

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there
My question is how do I update multiple records (EJB CMP) without loading every EJB?
The situation is as following:
I have an EJB with ten attributs one of it is the state of the EJB. The states are like new, valid, active, old and so on. Now I would like to change all records with the state valid to active.
One way would be to make a finder method and select all valid records, load it as EJB and change there the state from valid to active.
I do not like this way because it is very resource intensive.
Is there a way to update the records directly? If I do it direct with SQL then I bypass the container management. So EJB which already are loaded do not change the state.
Thanks for any help
Andy
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, there is no other way to do it. You've enumerated the options. However, if you are using standard EJB caching (Option C) which only caches EJB state on a per-transaction basis, then there will be no problems with doing it in straight SQL with JDBC.
Kyle
 
Andy Dejung
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Kyle for your answer.
I thought so, but I hoped that there is an other solution.
Thanks again
Andy
 
You firghten me terribly. I would like to go home now. Here, take this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic