transaction edit
This commit is contained in:
@@ -39,7 +39,7 @@ public class Transaction implements Serializable {
|
||||
private Event event;
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "transaction", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JsonIgnoreProperties(value = { "userAccount", "transaction", "event", "registration" }, allowSetters = true)
|
||||
@JsonIgnoreProperties(value = { "transaction", "event", "registration" }, allowSetters = true)
|
||||
private Set<TransactionItem> transactionItems = new HashSet<>();
|
||||
|
||||
// jhipster-needle-entity-add-field - JHipster will add fields here
|
||||
|
||||
@@ -30,7 +30,7 @@ public class TransactionItem implements Serializable {
|
||||
@Column(name = "locked")
|
||||
private Boolean locked;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JsonIgnoreProperties(value = { "users", "transactionItems" }, allowSetters = true)
|
||||
private UserAccount userAccount;
|
||||
|
||||
|
||||
@@ -35,7 +35,9 @@ public interface TransactionRepository extends JpaRepository<Transaction, Long>
|
||||
@Query("select transaction from Transaction transaction left join fetch transaction.event")
|
||||
List<Transaction> findAllWithToOneRelationships();
|
||||
|
||||
@Query("select transaction from Transaction transaction left join fetch transaction.event where transaction.id =:id")
|
||||
@Query(
|
||||
"select transaction from Transaction transaction left join fetch transaction.event left join fetch transaction.transactionItems where transaction.id =:id"
|
||||
)
|
||||
Optional<Transaction> findOneWithToOneRelationships(@Param("id") Long id);
|
||||
|
||||
@Query(
|
||||
|
||||
@@ -272,6 +272,10 @@ public class TransactionResource {
|
||||
public ResponseEntity<Transaction> getTransaction(@PathVariable("id") Long id) {
|
||||
LOG.debug("REST request to get Transaction : {}", id);
|
||||
Optional<Transaction> transaction = transactionRepository.findOneWithEagerRelationships(id);
|
||||
// if (transaction.isPresent()) {
|
||||
// transaction.get().getTransactionItems().stream().sorted();
|
||||
// transaction.get().getTransactionItems().sort(Comparator.comparing(item -> item.getUserAccount().getName()));
|
||||
// }
|
||||
return ResponseUtil.wrapOrNotFound(transaction);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user