HHH-17738 : Add support for Oracle database AI Vector Search
This commit is contained in:
parent
60b0a63629
commit
a7efb5c9eb
|
@ -6,10 +6,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.vector;
|
package org.hibernate.vector;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import org.hibernate.boot.model.TypeContributions;
|
import org.hibernate.boot.model.TypeContributions;
|
||||||
import org.hibernate.boot.model.TypeContributor;
|
import org.hibernate.boot.model.TypeContributor;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
@ -19,8 +15,6 @@ import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.service.ServiceRegistry;
|
import org.hibernate.service.ServiceRegistry;
|
||||||
import org.hibernate.type.BasicArrayType;
|
import org.hibernate.type.BasicArrayType;
|
||||||
import org.hibernate.type.BasicType;
|
|
||||||
import org.hibernate.type.BasicTypeReference;
|
|
||||||
import org.hibernate.type.BasicTypeRegistry;
|
import org.hibernate.type.BasicTypeRegistry;
|
||||||
import org.hibernate.type.SqlTypes;
|
import org.hibernate.type.SqlTypes;
|
||||||
import org.hibernate.type.StandardBasicTypes;
|
import org.hibernate.type.StandardBasicTypes;
|
||||||
|
@ -32,13 +26,11 @@ import org.hibernate.type.spi.TypeConfiguration;
|
||||||
|
|
||||||
public class OracleVectorTypeContributor implements TypeContributor {
|
public class OracleVectorTypeContributor implements TypeContributor {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
|
||||||
final Dialect dialect = serviceRegistry.requireService( JdbcServices.class )
|
final Dialect dialect = serviceRegistry.requireService( JdbcServices.class ).getDialect();
|
||||||
.getDialect();
|
|
||||||
|
|
||||||
if ( dialect instanceof OracleDialect && dialect.getVersion().isSameOrAfter( 23 ) ) {
|
if ( dialect instanceof OracleDialect && dialect.getVersion().isSameOrAfter( 23, 4 ) ) {
|
||||||
final TypeConfiguration typeConfiguration = typeContributions.getTypeConfiguration();
|
final TypeConfiguration typeConfiguration = typeContributions.getTypeConfiguration();
|
||||||
final JavaTypeRegistry javaTypeRegistry = typeConfiguration.getJavaTypeRegistry();
|
final JavaTypeRegistry javaTypeRegistry = typeConfiguration.getJavaTypeRegistry();
|
||||||
final JdbcTypeRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeRegistry();
|
final JdbcTypeRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeRegistry();
|
||||||
|
|
|
@ -25,13 +25,6 @@ public class VectorArgumentValidator implements ArgumentsValidator {
|
||||||
|
|
||||||
public static final ArgumentsValidator INSTANCE = new VectorArgumentValidator();
|
public static final ArgumentsValidator INSTANCE = new VectorArgumentValidator();
|
||||||
|
|
||||||
private static final int[] availableVectorCodes = {
|
|
||||||
SqlTypes.VECTOR,
|
|
||||||
SqlTypes.VECTOR_INT8,
|
|
||||||
SqlTypes.VECTOR_FLOAT32,
|
|
||||||
SqlTypes.VECTOR_FLOAT64
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate(
|
public void validate(
|
||||||
List<? extends SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
|
|
|
@ -199,4 +199,12 @@ create table TestEntity (
|
||||||
)
|
)
|
||||||
----
|
----
|
||||||
|
|
||||||
For more detailed information please refer to the link:{user-guide-url}#embeddable-inheritance[Embeddable inheritance] user guide chapter.
|
For more detailed information please refer to the link:{user-guide-url}#embeddable-inheritance[Embeddable inheritance] user guide chapter.
|
||||||
|
|
||||||
|
[[oracle-vector]]
|
||||||
|
== Oracle Vector support
|
||||||
|
|
||||||
|
Oracle engineers contributed the support for vector data types and functions to the `hibernate-vector` module
|
||||||
|
to use with Oracle database version 23.4 and newer.
|
||||||
|
|
||||||
|
For further information about vectors, consult the link:https://docs.oracle.com/en/database/oracle/oracle-database/23/vecse/overview-node.html[Oracle documentation].
|
||||||
|
|
Loading…
Reference in New Issue