Last active
March 13, 2025 17:09
-
-
Save juarezjuniorgithub/3f8f047aafa02505967753aae134702b to your computer and use it in GitHub Desktop.
HibernateVectorDataTypeEntity.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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") | |
public class HibernateVectorDataTypeEntity { | |
@Id | |
@GeneratedValue(strategy = GenerationType.IDENTITY) | |
private Long id; | |
@Column(name = "embedding") | |
@JdbcTypeCode(SqlTypes.VECTOR_FLOAT32) | |
@Array(length = 3) | |
private float[] embedding; | |
public float[] getEmbedding() { | |
return embedding; | |
} | |
public void setEmbedding(float[] embedding) { | |
this.embedding = embedding; | |
} | |
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