}
}
+ public void bulkIndexProfile(int profileId) {
+ SqlSession session = myBatis.openSession();
+ try {
+ bulkIndexProfile(profileId, session);
+ } finally {
+ MyBatis.closeQuietly(session);
+ }
+ }
+
public void bulkIndexProfile(int profileId, SqlSession session) {
bulkIndexActiveRules(activeRuleDao.selectByProfileId(profileId, session), session);
}
QualityProfileDto profileDto = findNotNull(profileId, session);
checkNotAlreadyExists(copyProfileName, profileDto.getLanguage(), session);
int copyProfileId = profilesManager.copyProfile(profileId, copyProfileName);
- session.commit();
- esActiveRule.bulkIndexProfile(copyProfileId, session);
+
+ // Cannot reuse same session as hibernate as create active rules in another session
+ esActiveRule.bulkIndexProfile(copyProfileId);
} finally {
MyBatis.closeQuietly(session);
}
operations.copyProfile(1, "Copy Default", authorizedUserSession);
verify(profilesManager).copyProfile(1, "Copy Default");
- verify(session).commit();
- verify(esActiveRule).bulkIndexProfile(2, session);
+ verify(esActiveRule).bulkIndexProfile(2);
}
@Test