Spring JPA Repository – Operator SIMPLE_PROPERTY on jsonObject requires a scalar argument

I encountered this same problem. I worked around it by changing the name of my method by adding “In” to the end of it. For your example, it would be findAllByTagsIn(java.util.Set) See the “supported keywords inside method names” table here: https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods.query-creation

how to lazy load collection when using spring-data-jpa, with hibernate, from an console application

One solution can be to make User.orders an eagerly fetched collection by @OneToMany(cascade=CascadeType.ALL, fetch = FetchType.EAGER) private Set<Order> orders = new HashSet<Order>(); Entity associations are lazily loaded by default. This means that the orders Set is actually just a proxy object that won’t get initialized until you invoke a method on it. This is good, … Read more

@Transactional annotation works with saveAndFlush?

Will the previous write operations in table A and table B be rollbacked? Yes, unless your saveAndFlush() methods have their own transactions (i.e. with propagation = REQUIRES_NEW). If they’re all part of the transaction you started in saveAndGenerateResult(), all modifications made to the database will be rolled back in case of failure. For more information: … Read more

Can Spring Data REST’s QueryDSL integration be used to perform more complex queries?

I think you should be able to get this to work using the following customization: bindings.bind(user.dateOfBirth).all((path, value) -> { Iterator<? extends LocalDate> it = value.iterator(); return path.between(it.next(), it.next()); }); The key here is to use ?dateOfBirth=…&dateOfBirth= (use the property twice) and the ….all(…) binding which will give you access to all values provided. Make sure … Read more

What is the difference between query-methods find…By, read…By, query…By, and get…By in spring data?

EDIT: This answer covers Spring query creation mechanism described in docs If you are looking for the differences between concrete methods findById(..) vs getById(..) you can find nice desciption here (thanks to @smile comment) ORIGINAL ANSWER: I don’t know how about other subprojects, but for Spring Data JPA (1.10.2) these methods will work as aliases. … Read more

How to shorten names of query methods in Spring Data JPA Repositories?

Use default Java 8 feature for wrapping, just like so: interface UserInterface extends JpaRepository<User, Long> { // use findOneByEmail instead User findOneByDeletedIsFalseAndEmail(String email); default User findOneByEmail(String email) { return findOneByDeletedIsFalseAndEmail(email); } } See an example. With Kotlin, you can use extension functions, for example: interface UserRepository : JpaRepository<User, Long> { // use findOneByEmail instead fun … Read more

Why are interface projections much slower than constructor projections and entity projections in Spring Data JPA with Hibernate?

I experienced similar behavior with an older version of Spring Data and this was my take on it: https://arnoldgalovics.com/how-much-projections-can-help/ I had a talk with Oliver Gierke (Spring Data lead) and he made some improvements (that’s why you get so “good” results 🙂 ) but basically there will be always a cost on having abstractions vs … Read more

Multiple Repositories for the Same Entity in Spring Data Rest

The terrible part is not only that you can only have 1 spring data rest repository (@RepositoryRestResource) per Entity but also that if you have a regular JPA @Repository (like CrudRepository or PagingAndSorting) it will also interact with the spring data rest one (as the key in the map is the Entity itself). Lost quite … Read more