When I create a method of a Spring Data repository like findByName(…)
everything works fine. But when using findByField1AndName(…)
Spring Data MongoDB generates query only for the last parameter:
{ name : 'qwerty' }
But I expected it generates
{ field1 : 'something', name : 'querty' }
What's the problem? Please help.
UPD1: If anyone has such a problem, you can use @Query annotation to manually build your query, example below:
@Query("{ region: ?0, product: ?1, direction: ?2, deliveryCondition: ?3, sortament: ?4}")
QuotationKey findByRegionAndProductAndMarketDirectionAndDeliveryConditionAndSortament(
Geography region, Product product, MarketDirection direction,
DeliveryCondition deliveryCondition, Sortament sortament);