meals-made-easy-api/src/main/java/app/mealsmadeeasy/api/recipe/RecipeEmbeddingEntity.java

64 lines
1.3 KiB
Java

package app.mealsmadeeasy.api.recipe;
import jakarta.persistence.*;
import org.hibernate.annotations.Array;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;
import org.jetbrains.annotations.Nullable;
import java.time.OffsetDateTime;
@Entity
@Table(name = "recipe_embedding")
public class RecipeEmbeddingEntity {
@Id
private Integer id;
@OneToOne(fetch = FetchType.LAZY, optional = false)
@MapsId
@JoinColumn(name = "recipe_id")
private Recipe recipe;
@JdbcTypeCode(SqlTypes.VECTOR)
@Array(length = 1024)
@Nullable
private float[] embedding;
@Column(nullable = false)
private OffsetDateTime timestamp;
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Recipe getRecipe() {
return this.recipe;
}
public void setRecipe(Recipe recipe) {
this.recipe = recipe;
}
public float[] getEmbedding() {
return this.embedding;
}
public void setEmbedding(float[] embedding) {
this.embedding = embedding;
}
public OffsetDateTime getTimestamp() {
return this.timestamp;
}
public void setTimestamp(OffsetDateTime timestamp) {
this.timestamp = timestamp;
}
}