forked from mtusi2026/mtusi2026lab4
36 lines
1.1 KiB
Java
36 lines
1.1 KiB
Java
package ru.mtusi.messenger.entity;
|
|
|
|
import jakarta.persistence.*;
|
|
import java.time.OffsetDateTime;
|
|
import java.util.UUID;
|
|
|
|
@Entity
|
|
@Table(name = "messages")
|
|
public class MessageEntity {
|
|
@Id
|
|
private UUID id;
|
|
|
|
@Column(name = "chat_id", nullable = false)
|
|
private UUID chatId;
|
|
|
|
@Column(name = "sender_id", nullable = false)
|
|
private UUID senderId;
|
|
|
|
@Column(nullable = false, length = 4000)
|
|
private String text;
|
|
|
|
@Column(name = "created_at", nullable = false)
|
|
private OffsetDateTime createdAt;
|
|
|
|
// Геттеры и сеттеры
|
|
public UUID getId() { return id; }
|
|
public void setId(UUID id) { this.id = id; }
|
|
public UUID getChatId() { return chatId; }
|
|
public void setChatId(UUID chatId) { this.chatId = chatId; }
|
|
public UUID getSenderId() { return senderId; }
|
|
public void setSenderId(UUID senderId) { this.senderId = senderId; }
|
|
public String getText() { return text; }
|
|
public void setText(String text) { this.text = text; }
|
|
public OffsetDateTime getCreatedAt() { return createdAt; }
|
|
public void setCreatedAt(OffsetDateTime createdAt) { this.createdAt = createdAt; }
|
|
} |