Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

General advice on CMR fields sought

Conrad Crampton
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following situation...
Entity bean x with relationship to entity bean y of 1:M and am using CMR to manage this with the many side stored as a collection.
When I create entity bean x, I also (in the same jsp) create many entity beans of y. I am using a stateless session bean to manage the create etc of x and y which are both local beans.
A couple of questions on this
1. do I use the session bean to create all entities then use the session bean to call the setX method for each entity bean y
2. do I do 1. above but use the session bean to call setY (as a collection of YLocal's) as returned by each of the createY methods?
Once created I want to edit entity x and possibly the entities y.
How do I manage the collection of y?
1. Do I remove the whole collection and re-add the new collection (this seems a bit I/O intensive)?
2. Can't think of any other way but I am convinced there is a better way than 1. as this gives some odd errors in 9.0.3 to do with transactions - all entity beans have transaction management set to 'required' as does the session bean.

Any suggestions, guidance, referral to tutorials, code samples etc. would be most appreciated. I have read a few tutorials but can't seem to find anything that addresses this specific.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic