Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation Timestamp updating in result but when I get from database nothing changes. #3405

Closed
Lazizkhan1 opened this issue Mar 20, 2024 · 1 comment
Labels
status: invalid An issue that we don't feel is valid

Comments

@Lazizkhan1
Copy link

Lazizkhan1 commented Mar 20, 2024

Get.All.-.OY_.Gul.2024-03-20.23-21-14.mp4

I thought the result after updating shouldn't be changed into.

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.SourceType;
import org.hibernate.annotations.UpdateTimestamp;

import java.math.BigDecimal;
import java.time.ZonedDateTime;
import java.util.UUID;

@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "additional_expenses")
@Entity
public class AdditionalExpenses {
    @Id
    @GeneratedValue(strategy = GenerationType.UUID)
    private UUID id;

    @Column(nullable = false)
    private UUID branchId;

    @Column(nullable = false, precision = 15, scale = 2)
    private BigDecimal amount;

    @Column(nullable = false)
    private String reason;

    @Temporal(TemporalType.TIMESTAMP)
    private ZonedDateTime expenseDate;

    @Column(updatable = false)
    @Temporal(TemporalType.TIMESTAMP)
    @CreationTimestamp(source = SourceType.VM)
    private ZonedDateTime createdAt;

    @Temporal(TemporalType.TIMESTAMP)
    @UpdateTimestamp(source = SourceType.VM)
    private ZonedDateTime updatedAt;

    @Temporal(TemporalType.TIMESTAMP)
    private ZonedDateTime deletedAt;
} 
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 20, 2024
@schauder
Copy link
Contributor

A video is not a proper issue description. I'm not going to watch this over an over again until I'm sure I understand what you want.

In case you are assuming the created timestamp shouldn't get updated when you update it explicitely, you are wrong. Make it insert only if you want that behaviour.

@schauder schauder closed this as not planned Won't fix, can't repro, duplicate, stale Mar 21, 2024
@schauder schauder added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants