This content has been marked as final.
Show 1 reply
-
1. Re: how to deal with
lafr Feb 5, 2006 4:41 PM (in response to john_woo)The message "A CMR collection may only be used within the transction in which it was created!" was often discussed here.
Creating the collection and iterating through it have to be don in the same transaction.
From a servlet you'll probably have to use a user transaction.
UserTransaction transaction = ...lookup( "UserTransaction");
transaction.begin();
Collection c = d.getEmployee();
Iterator iter = c.iterator();
while ( iter.hasNext() ) {
// do something useful
}
transaction.commit();