Merge pull request #25 from bsinno/fix_mysql_empty_in_statement
Fix mysql empty in statement
This commit is contained in:
@@ -249,6 +249,14 @@ public class RolloutManagement {
|
|||||||
final RolloutGroupConditions conditions) {
|
final RolloutGroupConditions conditions) {
|
||||||
final Rollout savedRollout = createRollout(rollout, amountGroup);
|
final Rollout savedRollout = createRollout(rollout, amountGroup);
|
||||||
creatingRollouts.add(savedRollout.getName());
|
creatingRollouts.add(savedRollout.getName());
|
||||||
|
// need to flush the entity manager here to get the ID of the rollout,
|
||||||
|
// because entity manager is set to FlushMode#Auto, entitymanager will
|
||||||
|
// flush the Target entity, due the indirect relationship to the Rollout
|
||||||
|
// entity without set an ID JPA is throwing a Invalid
|
||||||
|
// 'org.springframework.dao.InvalidDataAccessApiUsageException: During
|
||||||
|
// synchronization aect was found through a relationship that was not
|
||||||
|
// marked cascade PERSIST'
|
||||||
|
entityManager.flush();
|
||||||
executor.execute(() -> {
|
executor.execute(() -> {
|
||||||
try {
|
try {
|
||||||
final DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
final DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
||||||
@@ -336,7 +344,6 @@ public class RolloutManagement {
|
|||||||
cacheWriteNotify.rolloutGroupCreated(groupIndex, savedRollout.getId(), savedGroup.getId(),
|
cacheWriteNotify.rolloutGroupCreated(groupIndex, savedRollout.getId(), savedGroup.getId(),
|
||||||
amountGroupValidated, groupIndex);
|
amountGroupValidated, groupIndex);
|
||||||
pageIndex += groupSize;
|
pageIndex += groupSize;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
savedRollout.setStatus(RolloutStatus.READY);
|
savedRollout.setStatus(RolloutStatus.READY);
|
||||||
|
|||||||
@@ -1010,7 +1010,7 @@ public class TargetManagement {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||||
public List<Target> createTargets(@NotNull final List<Target> targets) {
|
public List<Target> createTargets(@NotNull final List<Target> targets) {
|
||||||
if (targetRepository.countByControllerIdIn(
|
if (!targets.isEmpty() && targetRepository.countByControllerIdIn(
|
||||||
targets.stream().map(target -> target.getControllerId()).collect(Collectors.toList())) > 0) {
|
targets.stream().map(target -> target.getControllerId()).collect(Collectors.toList())) > 0) {
|
||||||
throw new EntityAlreadyExistsException();
|
throw new EntityAlreadyExistsException();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user