54
This commit is contained in:
parent
c24dace777
commit
cc1a023999
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
data.mv.db
BIN
data.mv.db
Binary file not shown.
@ -23,7 +23,7 @@ public class OrderEntity extends BaseEntity {
|
||||
@JoinColumn()
|
||||
private UserEntity user;
|
||||
@JsonManagedReference
|
||||
@OneToMany(fetch = FetchType.EAGER)
|
||||
@OneToMany
|
||||
private final List<OrderLineEntity> lines = new ArrayList<>();
|
||||
private Double totalPrice;
|
||||
|
||||
|
@ -32,6 +32,7 @@ public class OrderService {
|
||||
return repository.findAll();
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public OrderEntity get(Long id) {
|
||||
return repository.findById(id)
|
||||
.orElseThrow(() -> new NotFoundException(OrderEntity.class, id));
|
||||
@ -41,6 +42,7 @@ public class OrderService {
|
||||
return repository.save(entity);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public OrderEntity update(Long id, OrderEntity entity) {
|
||||
final OrderEntity existEntity = get(id);
|
||||
existEntity.setUser(entity.getUser());
|
||||
@ -54,6 +56,7 @@ public class OrderService {
|
||||
return repository.save(existEntity);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public OrderEntity delete(Long id) {
|
||||
final OrderEntity existsEntity = get(id);
|
||||
repository.delete(existsEntity);
|
||||
|
Loading…
x
Reference in New Issue
Block a user