在liferay中,我有一個要求,如果我更新多個用戶的角色,如果其中一個更新用戶角色失敗,那麼我想回滾用戶的所有更新角色。我已經申請如下。如何在liferay中實現交易?
@Transactional(isolation = Isolation.SERIALIZABLE,
propagation = Propagation.REQUIRES_NEW)
public int updateUserRole(long userId,long groupId,long roleId) throws SystemException{
try{
return UserTokenFinderUtil.updateUserRole(userId,groupId,roleId);
}
catch(Exception e){
System.out.println("Exception occured UserTokenServiceImpl");
e.printStackTrace();
return -1;
}
}
任何人都可以用新鮮的眼睛幫助我嗎?