• Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiple Updates  RSS feed

 
Andy Dejung
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!