Skip to content

Commit 6cdb6ce

Browse files
committed
Workaround to make Contains queries work.
Due to a bug in Hibernate (https://hibernate.atlassian.net/browse/HHH-15142), any Like-based custom finder will fail when submitted to the Entity Manager a second time. This patch includes a workaround until Hibernate 5.6.9.Final is released. See also: spring-projects/spring-data-jpa#2519, spring-projects/spring-data-jpa#2472 See #636.
1 parent 586092a commit 6cdb6ce

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

jpa/vavr/src/main/java/example/PersonRepository.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.util.Optional;
2626

2727
import org.springframework.data.repository.Repository;
28+
import org.springframework.data.repository.query.Param;
2829

2930
/**
3031
* Repository interface showing the usage of Vavr collections and its {@link Option} type as repository query method
@@ -51,13 +52,13 @@ public interface PersonRepository extends Repository<Person, Long> {
5152
* @param firstname
5253
* @return
5354
*/
54-
Seq<Person> findByFirstnameContaining(String firstname);
55+
Seq<Person> findByFirstnameContaining(@Param("firstname") String firstname);
5556

5657
/**
5758
* Returning a {@link Try} is supported out of the box with all exceptions being handled by {@link Try} immediately.
5859
*
5960
* @param lastname
6061
* @return
6162
*/
62-
Try<Option<Person>> findByLastnameContaining(String lastname);
63+
Try<Option<Person>> findByLastnameContaining(@Param("lastname") String lastname);
6364
}

0 commit comments

Comments
 (0)