After migration from spring-data-jpa 2.7.1 to 3.1.2 (SpringBoot 3.1.2 migration) in method:
@Query("""
SELECT o
FROM Storage o
WHERE o.status = 'SUCCESS'
AND (
(:referenceNumbers) IS NULL
OR o.referenceNumber IN (:referenceNumbers)
)
...
""")
Page<Storage> findObject(ObjectFilter filter, Set<String> referenceNumbers, Iterable<Long> systemIds, Pageable pageable);
@Entity
@Getter
@Setter
@RequiredArgsConstructor
@EqualsAndHashCode
@Accessors(chain = true)
class Storage {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String referenceNumber;
@Enumerated(EnumType.STRING)
private Status status;
}
I'm getting:
org.springframework.orm.jpa.JpaSystemException: Unknown wrap conversion requested: java.util.ImmutableCollections$Set12 to java.lang.String :
org.hibernate.type.descriptor.java.StringJavaType
(java.lang.String)
Seems like IN
method is not able to handle Collection anymore
I was trying to find documentation for JPQL IN
method but could not find anything relevant.
For Spring Data JPA 2.7.1, this method was working perfectly fine.
I tried to find documentation for the IN
method for Spring Data JPA 3.1.2, because I have many similar methods in project and my app might be working with many databases (PostgreSQL, Oracle).