Skip to content

Commit 8e51148

Browse files
committed
Add Oracle integration tests.
1 parent 7bb4e63 commit 8e51148

17 files changed

+593
-402
lines changed

pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<jsqlparser>5.0</jsqlparser>
3939
<mysql-connector-java>9.1.0</mysql-connector-java>
4040
<postgresql>42.7.4</postgresql>
41+
<oracle>23.7.0.25.01</oracle>
4142
<springdata.commons>4.0.0-SEARCH-RESULT-SNAPSHOT</springdata.commons>
4243
<vavr>0.10.3</vavr>
4344

@@ -120,6 +121,19 @@
120121
</includes>
121122
</configuration>
122123
</execution>
124+
<execution>
125+
<id>oracle-test</id>
126+
<phase>test</phase>
127+
<goals>
128+
<goal>test</goal>
129+
</goals>
130+
<configuration>
131+
<includes>
132+
<include>**/Oracle*IntegrationTests.java
133+
</include>
134+
</includes>
135+
</configuration>
136+
</execution>
123137
</executions>
124138
</plugin>
125139
</plugins>

spring-data-jpa/pom.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,28 @@
167167
<scope>test</scope>
168168
</dependency>
169169

170+
<!-- Oracle testing support -->
171+
172+
<dependency>
173+
<groupId>com.oracle.database.jdbc</groupId>
174+
<artifactId>ojdbc17</artifactId>
175+
<version>${oracle}</version>
176+
<scope>test</scope>
177+
</dependency>
178+
179+
<dependency>
180+
<groupId>com.oracle.database.jdbc</groupId>
181+
<artifactId>ucp17</artifactId>
182+
<version>${oracle}</version>
183+
<scope>test</scope>
184+
</dependency>
185+
186+
<dependency>
187+
<groupId>org.testcontainers</groupId>
188+
<artifactId>oracle-free</artifactId>
189+
<scope>test</scope>
190+
</dependency>
191+
170192
<dependency>
171193
<groupId>io.vavr</groupId>
172194
<artifactId>vavr</artifactId>
@@ -331,6 +353,7 @@
331353
<exclude>**/EclipseLink*</exclude>
332354
<exclude>**/MySql*</exclude>
333355
<exclude>**/Postgres*</exclude>
356+
<exclude>**/Oracle*</exclude>
334357
</excludes>
335358
<argLine>
336359
-Xmx4G

spring-data-jpa/src/main/java/org/springframework/data/jpa/convert/VectorConverters.java

Lines changed: 0 additions & 61 deletions
This file was deleted.

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryCreator.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
import org.jspecify.annotations.Nullable;
3939

40+
import org.springframework.dao.InvalidDataAccessApiUsageException;
4041
import org.springframework.data.domain.Range;
4142
import org.springframework.data.domain.Score;
4243
import org.springframework.data.domain.ScoringFunction;
@@ -467,11 +468,10 @@ public JpqlQueryBuilder.Predicate build() {
467468
PartTreeParameterBinding parameter = provider.next(part, String.class);
468469
JpqlQueryBuilder.Expression parameterExpression = potentiallyIgnoreCase(part.getProperty(),
469470
placeholder(parameter));
471+
470472
// Predicate like = builder.like(propertyExpression, parameterExpression, escape.getEscapeCharacter());
471473
String escapeChar = Character.toString(escape.getEscapeCharacter());
472-
return
473-
474-
type.equals(NOT_LIKE) || type.equals(NOT_CONTAINING)
474+
return type.equals(NOT_LIKE) || type.equals(NOT_CONTAINING)
475475
? whereIgnoreCase.notLike(parameterExpression, escapeChar)
476476
: whereIgnoreCase.like(parameterExpression, escapeChar);
477477
case TRUE:
@@ -498,15 +498,14 @@ public JpqlQueryBuilder.Predicate build() {
498498

499499
where = JpqlQueryBuilder.where(entity, property);
500500
return type.equals(IS_NOT_EMPTY) ? where.isNotEmpty() : where.isEmpty();
501-
502501
case WITHIN:
503502
case NEAR:
504503
PartTreeParameterBinding vector = provider.next(part);
505504
PartTreeParameterBinding within = provider.next(part);
506505

507506
if (within.getValue() instanceof Range<?> r) {
508507

509-
Range<Score> range = (Range<Score>) within.getValue();
508+
Range<Score> range = (Range<Score>) r;
510509

511510
if (range.getUpperBound().isBounded() || range.getUpperBound().isBounded()) {
512511

@@ -552,6 +551,8 @@ public JpqlQueryBuilder.Predicate build() {
552551
return getUpperPredicate(true, distance, distanceValue);
553552
}
554553

554+
throw new InvalidDataAccessApiUsageException(
555+
"Near/Within keywords must be used with a Score or Range<Score> type");
555556
default:
556557
throw new IllegalArgumentException("Unsupported keyword " + type);
557558
}

0 commit comments

Comments
 (0)