Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #43 from 7SOATSquad30/fix/entity-persistence
Browse files Browse the repository at this point in the history
fix: do not allow the 'createdAt' column to be updated
  • Loading branch information
jonasmzsouza authored Jul 30, 2024
2 parents b1c9023 + 0524266 commit f3cb6f1
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class CategoryEntity {
@Column(nullable = false, unique = true)
private String name;

@Column(columnDefinition = "TIMESTAMP WITHOUT TIME ZONE")
@Column(columnDefinition = "TIMESTAMP WITHOUT TIME ZONE", updatable = false)
private Instant createdAt;

@Column(columnDefinition = "TIMESTAMP WITHOUT TIME ZONE")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class CustomerEntity {
@OneToMany(mappedBy = "customer")
private List<OrderEntity> orders = new ArrayList<>();

@Column(columnDefinition = "TIMESTAMP WITHOUT TIME ZONE")
@Column(columnDefinition = "TIMESTAMP WITHOUT TIME ZONE", updatable = false)
private Instant createdAt;

@Column(columnDefinition = "TIMESTAMP WITHOUT TIME ZONE")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class OrderEntity {
orphanRemoval = true)
private Collection<OrderItemEntity> items;

@Column(columnDefinition = "TIMESTAMP WITHOUT TIME ZONE")
@Column(columnDefinition = "TIMESTAMP WITHOUT TIME ZONE", updatable = false)
private Instant createdAt;

@Column(columnDefinition = "TIMESTAMP WITHOUT TIME ZONE")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class PaymentEntity {
@Min(0)
private Double amount;

@Column(columnDefinition = "TIMESTAMP WITHOUT TIME ZONE")
@Column(columnDefinition = "TIMESTAMP WITHOUT TIME ZONE", updatable = false)
private Instant createdAt;

@Column(columnDefinition = "TIMESTAMP WITHOUT TIME ZONE")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class ProductEntity {
@JoinColumn(name = "category_id", nullable = false)
private CategoryEntity category;

@Column(columnDefinition = "TIMESTAMP WITHOUT TIME ZONE")
@Column(columnDefinition = "TIMESTAMP WITHOUT TIME ZONE", updatable = false)
private Instant createdAt;

@Column(columnDefinition = "TIMESTAMP WITHOUT TIME ZONE")
Expand Down

0 comments on commit f3cb6f1

Please sign in to comment.