• Post Reply Bookmark Topic Watch Topic
  • New Topic

HELP!!! CMR IllegalStateException Collection  RSS feed

 
Don Escuro
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have the following code in my session bean which interfaces several cmr entity beans and Im currently at a loss ...
Please find the line: cGroups = groupLevel.getGroups(); where the said exception occurs ...
Thanks in advance ...
public Map getRelatedGroups(GroupLevelPK groupLevelPK)
throws NotFoundException {
Collection cGroups = null;
Hashtable htGroups = new Hashtable();
try {
groupLevel = groupLevelHome.findByPrimaryKey(groupLevelPK);
/*
the next line returns the following exception message:
java.lang.IllegalStateException: Collection may have been accessed after transaction completion.
*/
cGroups = groupLevel.getGroups();
Iterator iterator = cGroups.iterator();
while (iterator.hasNext()) {
:
:
:
 
Bill Dudney
Author
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Don,
I think the easy thing is to simply declare the session's method that is accessign the CMR's to be in one transaction. This will cause a transaction to wrap all your interaction with your entities which should get rid of that pesky exception.
It looks what is happening now is that your session is executing without a transaction so each call to the entities is one transaction.

Got bit by this several times! Hope this helps.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!