Files
skamp/src/main/java/de/iwomm/propify_api/entity/FederalState.java
2025-10-02 18:01:23 +02:00

97 lines
1.9 KiB
Java

package de.iwomm.propify_api.entity;
import jakarta.persistence.*;
import java.time.LocalDateTime;
import java.util.UUID;
@Entity
public class FederalState {
@Id
@GeneratedValue(strategy = GenerationType.UUID)
@Column(nullable = false)
private UUID id;
private String name;
private String abbreviation;
@ManyToOne(cascade = CascadeType.REMOVE, optional = false)
@JoinColumn(nullable = false)
private Country country;
private LocalDateTime createdAt;
private LocalDateTime updatedAt;
public FederalState(String name, String abbreviation, Country country) {
this.name = name;
this.abbreviation = abbreviation;
this.country = country;
}
public FederalState() {
}
public void setCountry(Country country) {
this.country = country;
}
public Country getCountry() {
return country;
}
@PrePersist
protected void onCreate() {
this.createdAt = LocalDateTime.now();
this.updatedAt = LocalDateTime.now();
}
@PreUpdate
protected void onUpdate() {
this.updatedAt = LocalDateTime.now();
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public LocalDateTime getCreatedAt() {
return createdAt;
}
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
public LocalDateTime getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(LocalDateTime updatedAt) {
this.updatedAt = updatedAt;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
}