Skip to content

Instantly share code, notes, and snippets.

@CremboC
Created April 16, 2015 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CremboC/aa25c15152ee692ad67f to your computer and use it in GitHub Desktop.
Save CremboC/aa25c15152ee692ad67f to your computer and use it in GitHub Desktop.
StaleObjectException :D
final Collection<Sample> allByBarcode = sampleService.byBarcode(groupRequest.getSamples(), currentUser);
if (!allByBarcode.isEmpty()) {
Group group = new Group();
group.setName(groupRequest.getName());
group.setSamples(allByBarcode);
group.setType(groupRequest.getType());
group.setOwner(currentUser);
group = repository.save(group);
return Optional.ofNullable(group);
}
final Collection<Sample> allByBarcode = sampleService.byBarcode(groupRequest.getSamples(), currentUser);
if (!allByBarcode.isEmpty()) {
Group group = new Group();
group.setName(groupRequest.getName());
group.setSamples(new HashSet<>(allByBarcode));
group.setType(groupRequest.getType());
group.setOwner(currentUser);
group = repository.save(group);
return Optional.ofNullable(group);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment