[Bug #1065] Fixed issue adding method to open a new transaction on DAO.
* Added method findUniqueByNameAnotherTransaction to CalendarExceptionTypeDAO. * Renamed method findByName to findUniqueByName in CalendarExceptionTypeDAO. FEA: ItEr74S04BugFixing
This commit is contained in:
parent
41c357a3c3
commit
408686138f
3 changed files with 15 additions and 4 deletions
|
|
@ -82,7 +82,7 @@ public class CalendarExceptionTypeDAO extends
|
|||
@Override
|
||||
public boolean existsByName(String name) {
|
||||
try {
|
||||
findByName(name);
|
||||
findUniqueByName(name);
|
||||
return true;
|
||||
} catch (InstanceNotFoundException e) {
|
||||
return false;
|
||||
|
|
@ -91,7 +91,7 @@ public class CalendarExceptionTypeDAO extends
|
|||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public CalendarExceptionType findByName(String name) throws InstanceNotFoundException {
|
||||
public CalendarExceptionType findUniqueByName(String name) throws InstanceNotFoundException {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
throw new InstanceNotFoundException(null, CalendarExceptionType.class.getName());
|
||||
}
|
||||
|
|
@ -109,4 +109,11 @@ public class CalendarExceptionTypeDAO extends
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW)
|
||||
public CalendarExceptionType findUniqueByNameAnotherTransaction(String name)
|
||||
throws InstanceNotFoundException {
|
||||
return findUniqueByName(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,8 +44,11 @@ public interface ICalendarExceptionTypeDAO extends
|
|||
|
||||
boolean existsByNameAnotherTransaction(String name);
|
||||
|
||||
CalendarExceptionType findByName(String name) throws InstanceNotFoundException;
|
||||
CalendarExceptionType findUniqueByName(String name) throws InstanceNotFoundException;
|
||||
|
||||
boolean existsByName(String name);
|
||||
|
||||
CalendarExceptionType findUniqueByNameAnotherTransaction(String name)
|
||||
throws InstanceNotFoundException;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,7 +167,8 @@ public class CalendarExceptionType extends IntegrationEntity {
|
|||
name);
|
||||
} else {
|
||||
try {
|
||||
CalendarExceptionType calendarExceptionType = calendarExceptionTypeDAO.findByName(name);
|
||||
CalendarExceptionType calendarExceptionType = calendarExceptionTypeDAO
|
||||
.findUniqueByNameAnotherTransaction(name);
|
||||
return calendarExceptionType.getId().equals(getId());
|
||||
} catch (InstanceNotFoundException e) {
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue