Skip to content

Commit 5cdcb2c

Browse files
loiclefevrebeikov
authored andcommitted
HHH-18157 Document 23ai new features where necessary
1 parent 51f0692 commit 5cdcb2c

File tree

5 files changed

+37
-13
lines changed

5 files changed

+37
-13
lines changed

documentation/src/main/asciidoc/quickstart/guides/obtaining.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ transitive dependencies based on the features being used or not.
4343
|hibernate-envers| Entity versioning and auditing
4444
|hibernate-spatial| Support for spatial/GIS data types using https://github.com/GeoLatte/geolatte-geom[GeoLatte]
4545
|hibernate-jpamodelgen| An annotation processor that generates a JPA-compliant metamodel, plus optional Hibernate extras
46+
|hibernate-vector| Support for mathematical vector types and functions useful for AI/ML topics like vector similarity search and Retrieval-Augmented Generation (RAG)
4647
|===
4748

4849
[cols="40m,~"]
@@ -53,6 +54,7 @@ transitive dependencies based on the features being used or not.
5354
|hibernate-hikaricp| Support for https://github.com/brettwooldridge/HikariCP/[HikariCP] connection pooling
5455
|hibernate-vibur| Support for https://www.vibur.org/[Vibur DBCP] connection pooling
5556
|hibernate-proxool| Support for https://proxool.sourceforge.net/[Proxool] connection pooling
57+
|hibernate-ucp| Support for https://docs.oracle.com/en/database/oracle/oracle-database/23/jjucp/intro.html[Universal Connection Pool] connection pooling
5658
|hibernate-jcache| Integration with https://jcp.org/en/jsr/detail?id=107$$[JCache], allowing any compliant implementation as a second-level cache provider
5759
|hibernate-graalvm| Experimental extension to make it easier to compile applications as a https://www.graalvm.org/[GraalVM] native image
5860
|hibernate-micrometer| Integration with https://micrometer.io[Micrometer] metrics

documentation/src/main/asciidoc/userguide/Bibliography.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
Addison-Wesley Professional. 2002.
55
- [[[JPwH]]] Christian Bauer & Gavin King. https://www.manning.com/books/java-persistence-with-hibernate-second-edition[Java Persistence with Hibernate, Second Edition]. Manning Publications Co. 2015.
66
- [[[jdbc]]] https://download.oracle.com/otndocs/jcp/jdbc-4_2-mrel2-spec/[JDBC Specification - Version 4.2]
7+
- [[[jdbc]]] https://download.oracle.com/otndocs/jcp/jdbc-4_3-mrel3-spec/[JDBC Specification - Version 4.3]

documentation/src/main/asciidoc/userguide/appendices/Legacy_Native_Queries.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ If your mapping has a discriminator you must use `<return-discriminator>` to spe
170170
Hibernate provides support for queries via stored procedures and functions.
171171
Most of the following documentation is equivalent for both.
172172
The stored procedure/function must return a resultset as the first out-parameter to be able to work with Hibernate.
173-
An example of such a stored function in Oracle 9 and higher is as follows:
173+
An example of such a stored function in Oracle 19c and higher is as follows:
174174

175175
[source,xml]
176176
----

documentation/src/main/asciidoc/userguide/chapters/query/extensions/Vector.adoc

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
=== Overview
1010

1111
The Hibernate ORM Vector module contains support for mathematical vector types and functions.
12-
This is useful for AI/ML topics like vector similarity search.
13-
The module comes with support for a special `vector` data type that essentially represents an array of floats.
12+
This is useful for AI/ML topics like vector similarity search and Retrieval-Augmented Generation (RAG).
13+
The module comes with support for a special `vector` data type that essentially represents an array of bytes, floats, or doubles.
1414

15-
So far, only the PostgreSQL extension `pgvector` is supported, but in theory,
15+
So far, both the PostgreSQL extension `pgvector` and the Oracle database 23ai+ `AI Vector Search` feature are supported, but in theory,
1616
the vector specific functions could be implemented to work with every database that supports arrays.
1717

18-
For further details, refer to the https://github.com/pgvector/pgvector#querying[pgvector documentation].
18+
For further details, refer to the https://github.com/pgvector/pgvector#querying[pgvector documentation] or the https://docs.oracle.com/en/database/oracle/oracle-database/23/vecse/overview-node.html[AI Vector Search documentation].
1919

2020
[[vector-module-setup]]
2121
=== Setup
@@ -44,6 +44,15 @@ so no further configuration is necessary to make the features available.
4444

4545
Annotate a persistent attribute with `@JdbcTypeCode(SqlTypes.VECTOR)` and specify the vector length with `@Array(length = ...)`.
4646

47+
[WARNING]
48+
====
49+
As Oracle AI Vector Search supports different types of elements (to ensure better performance and compatibility with embedding models), you can also use:
50+
51+
- `@JdbcTypeCode(SqlTypes.VECTOR_INT8)` for `byte[]`
52+
- `@JdbcTypeCode(SqlTypes.VECTOR_FLOAT32)` for `float[]`
53+
- `@JdbcTypeCode(SqlTypes.VECTOR_FLOAT64)` for `double[]`.
54+
====
55+
4756
[[vector-module-usage-example]]
4857
====
4958
[source, JAVA, indent=0]
@@ -63,18 +72,30 @@ Expressions of the vector type can be used with various vector functions.
6372
|===
6473
| Function | Purpose
6574

66-
| `cosine_distance()` | Computes the https://en.wikipedia.org/wiki/Cosine_similarity[cosine distance] between two vectors. Maps to the `<``=``>` operator
67-
| `euclidean_distance()` | Computes the https://en.wikipedia.org/wiki/Euclidean_distance[euclidean distance] between two vectors. Maps to the `<``-``>` operator
75+
| `cosine_distance()` | Computes the https://en.wikipedia.org/wiki/Cosine_similarity[cosine distance] between two vectors. Maps to the `<``=``>` operator for `pgvector` and maps to the `vector_distance(v1, v2, COSINE)` function for `Oracle AI Vector Search`.
76+
77+
| `euclidean_distance()` | Computes the https://en.wikipedia.org/wiki/Euclidean_distance[euclidean distance] between two vectors. Maps to the `<``-``>` operator for `pgvector` and maps to the
78+
`vector_distance(v1, v2, EUCLIDEAN)` function for `Oracle AI Vector Search`.
79+
6880
| `l2_distance()` | Alias for `euclidean_distance()`
69-
| `taxicab_distance()` | Computes the https://en.wikipedia.org/wiki/Taxicab_geometry[taxicab distance] between two vectors
81+
82+
| `taxicab_distance()` | Computes the https://en.wikipedia.org/wiki/Taxicab_geometry[taxicab distance] between two vectors. Maps to `vector_distance(v1, v2, MANHATTAN)` function for `Oracle AI Vector Search`.
83+
7084
| `l1_distance()` | Alias for `taxicab_distance()`
85+
86+
| `hamming_distance()` | Computes the https://en.wikipedia.org/wiki/Hamming_distance[hamming distance] between two vectors. Maps to `vector_distance(v1, v2, HAMMING)` function for `Oracle AI Vector Search`.
87+
7188
| `inner_product()` | Computes the https://en.wikipedia.org/wiki/Inner_product_space[inner product] between two vectors
72-
| `negative_inner_product()` | Computes the negative inner product. Maps to the `<``#``>` operator
89+
90+
| `negative_inner_product()` | Computes the negative inner product. Maps to the `<``#``>` operator for `pgvector` and maps to the
91+
`vector_distance(v1, v2, DOT)` function for `Oracle AI Vector Search`.
92+
7393
| `vector_dims()` | Determines the dimensions of a vector
94+
7495
| `vector_norm()` | Computes the https://en.wikipedia.org/wiki/Euclidean_space#Euclidean_norm[Euclidean norm] of a vector
7596
|===
7697

77-
In addition to these special vector functions, it is also possible to use vectors with the following builtin operators
98+
In addition to these special vector functions, it is also possible to use vectors with the following builtin `pgvector` operators:
7899

79100
`<vector1> + <vector2> = <vector3>`:: Element-wise addition of vectors.
80101
`<vector1> - <vector2> = <vector3>`:: Element-wise subtraction of vectors.

documentation/src/main/asciidoc/userguide/chapters/query/spatial/Spatial.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Since 5.0, Hibernate Spatial is now part of the Hibernate ORM project,
1313
and it allows you to deal with geographic data in a standardized way.
1414

1515
Hibernate Spatial provides a standardized, cross-database interface to geographic data storage and query functions.
16-
It supports most of the functions described by the OGC Simple Feature Specification. Supported databases are Oracle 10g/11g,
16+
It supports most of the functions described by the OGC Simple Feature Specification. Supported databases are Oracle 19c/21c/23ai,
1717
PostgreSQL/PostGIS, MySQL, Microsoft SQL Server, DB2, CockroachDB and H2/GeoDB.
1818

1919
Spatial data types are not part of the Java standard library, and they are absent from the JDBC specification.
@@ -72,7 +72,7 @@ functions largely correspond to those specified in the https://portal.opengeospa
7272
.Hibernate Spatial dialect function support
7373
[cols=",,,,,,,," |options="header",]
7474
|================================
75-
|Function | Description | PostgresSQL | Oracle 10g/11g | MySQL | SQLServer | H2GIS | DB2 | CockroachDB
75+
|Function | Description | PostgresSQL | Oracle 19c/21c/23ai | MySQL | SQLServer | H2GIS | DB2 | CockroachDB
7676
|Basic functions on Geometry | | | | | | | |
7777
|`int st_dimension(Geometry)` | SFS §2.1.1.1 | {yes} | {yes} | {yes} | {yes} | {yes} | {yes} | {yes}
7878
|`String st_geometrytype(Geometry)` | SFS §2.1.1.1 | {yes} | {yes} | {yes} | {yes} | {yes} | {yes} | {yes}
@@ -148,7 +148,7 @@ For more information, see this page in the MySQL reference guide (esp. the secti
148148

149149

150150
[[spatial-configuration-dialect-oracle]]
151-
Oracle10g/11g::
151+
Oracle 19c/21c/23ai::
152152

153153
There is currently only support for the `SDO_GEOMETRY` type.
154154
+

0 commit comments

Comments
 (0)