Files
mtusi2026lab6/src/main/java/ru/mtusi/messenger/entity/AttachmentVariantEntity.java
T

62 lines
2.2 KiB
Java

package ru.mtusi.messenger.entity;
import jakarta.persistence.*;
import java.io.Serializable;
import java.util.Objects;
import java.util.UUID;
@Entity
@Table(name = "attachment_variants")
@IdClass(AttachmentVariantId.class)
public class AttachmentVariantEntity {
@Id
@Column(name = "attachment_id")
private UUID attachmentId;
@Id
@Column(name = "name")
private String name;
@Column(name = "object_key", nullable = false, length = 255)
private String objectKey;
@Column(name = "content_type", nullable = false, length = 100)
private String contentType;
@Column(name = "size_bytes", nullable = false)
private long sizeBytes;
@Column(nullable = false, length = 64)
private String sha256;
@Column(nullable = false)
private int width;
@Column(nullable = false)
private int height;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "attachment_id", insertable = false, updatable = false)
private AttachmentEntity attachment;
// Геттеры и сеттеры
public UUID getAttachmentId() { return attachmentId; }
public void setAttachmentId(UUID attachmentId) { this.attachmentId = attachmentId; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getObjectKey() { return objectKey; }
public void setObjectKey(String objectKey) { this.objectKey = objectKey; }
public String getContentType() { return contentType; }
public void setContentType(String contentType) { this.contentType = contentType; }
public long getSizeBytes() { return sizeBytes; }
public void setSizeBytes(long sizeBytes) { this.sizeBytes = sizeBytes; }
public String getSha256() { return sha256; }
public void setSha256(String sha256) { this.sha256 = sha256; }
public int getWidth() { return width; }
public void setWidth(int width) { this.width = width; }
public int getHeight() { return height; }
public void setHeight(int height) { this.height = height; }
public AttachmentEntity getAttachment() { return attachment; }
public void setAttachment(AttachmentEntity attachment) { this.attachment = attachment; }
}