-
1. Re: How may I use CMR collections?
vladimir_l Dec 19, 2003 3:05 AM (in response to vladimir_l)Sorry guys!
My bad! I found where I was wrong. The UserTransaction must be javax.transaction.UserTransaction not a javax.jts.UserTransaction. This one came from WebLogic jar file that was in my classpath and seems to have nothing to do with Java standards and JBoss implementation.
So the following changes fix my problem:
import javax.transaction.UserTransaction;
//...
InitialContext ctx = new InitialContext();
UserTransaction ut = (UserTransaction)ctx.lookup("java:comp/UserTransaction");
GroupLocalHome groupHome = GroupUtil.getLocalHome();
GroupLocal group = groupHome.findByPrimaryKey(groupId);
ut.begin();
Collection roles = group.getRoles();
Iterator roleIterator = roles.iterator();
while (roleIterator.hasNext()) {
RoleLocal role = (RoleLocal) roleIterator.next();
// ...
}
ut.commit();
// ...
ctx.close();
Thanks for your attention :)