I am using Spring boot 3.3.2 and hibernate 6.5.2.Final. And I wanted to pass a Collection of a custom object to a query annotated with @Query inside a repository.
Adding that the Collection is not of the entity.
public class OrderEntity {
@Id private OrderId orderId;
private Merchant merchant;
...
public interface OrderRepository
extends Repository<OrderEntity, OrderId> {
@Query(
"from OrderEntity oe "
+ " and (: merchantFilter is null or oe.merchantId in : merchantFilter)")
CompletableFuture<Page<OrderEntity>> findOrders(Collection<Merchant> merchantFilter);
And the Merchant class has a toString to just return the merchantId. My idea is I wanted to know how can I add a converter specific for the named parameters or how to instruct the binder, to use a custom logic for it. Given it tries to bind it to varbinary and thus trying to serialize Merchant, and I do not want so. Appreciate your help