Skip to content

Instantly share code, notes, and snippets.

@chongma
Created April 24, 2020 15:33
Show Gist options
  • Select an option

  • Save chongma/c5501c414f898f501fc04a9339405c5f to your computer and use it in GitHub Desktop.

Select an option

Save chongma/c5501c414f898f501fc04a9339405c5f to your computer and use it in GitHub Desktop.
// at line 12 scaleFee.getScaleFeeItems() is in the right order but end of transaction does not reflect this
// @OneToMany(mappedBy = "scaleFee", cascade = CascadeType.ALL, orphanRemoval = true)
// @OrderColumn
// private List<ScaleFeeItem> scaleFeeItems;
@Transactional
public boolean createScaleFeeScaleFeeItem(Long id) {
ScaleFee scaleFee = scaleFeeDb.selectScaleFee(id);
if (scaleFee != null) {
ScaleFeeItem scaleFeeItem = new ScaleFeeItem(scaleFee, BigDecimal.ZERO, BigDecimal.ZERO, false);
scaleFee.getScaleFeeItems().add(scaleFeeItem);
Collections.sort(scaleFee.getScaleFeeItems(), new ScaleFeeItemComparator());
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment