try{
....
}catch(ObjectOptimisticLockingFailureException e){
e.getIdentifier(); -> this is just one id of conflicting entity.
}
如何获取所有冲突的实体???
这个解决方案怎么样?
List<Long> ids = Lists.newArrayList();
try{
}catch(ObjectOptimisticLockingFailureException e){
ids.add(e.getIdentifier());
}
if (!ids.isEmpty()){
throw MyRuntimeException(ids);
}