Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save juarezjuniorgithub/e5ad73237784d52d1b28f9b6689cce9d to your computer and use it in GitHub Desktop.
Save juarezjuniorgithub/e5ad73237784d52d1b28f9b6689cce9d to your computer and use it in GitHub Desktop.
HibernateVectorDataTypeEntity.java
/*
Copyright (c) 2024, Oracle and/or its affiliates.
This software is dual-licensed to you under the Universal Permissive License
(UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License
2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
either license.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.oracle.dev.jdbc;
import org.hibernate.annotations.Array;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
@Entity
@Table(name = "VECTOR_USER.vector_data_search")
public class HibernateVectorDataTypeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "embedding")
@JdbcTypeCode(SqlTypes.VECTOR_FLOAT32)
@Array(length = 3)
private float[] embedding;
@Column(name = "embedding_two")
@JdbcTypeCode(SqlTypes.VECTOR_FLOAT32)
@Array(length = 3)
private float[] embeddingTwo;
public float[] getEmbedding() {
return embedding;
}
public void setEmbedding(float[] embedding) {
this.embedding = embedding;
}
public float[] getEmbeddingTwo() {
return embeddingTwo;
}
public void setEmbeddingTwo(float[] embeddingTwo) {
this.embeddingTwo = embeddingTwo;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment