Y
Y
Yourmind2019-10-11 11:05:58
PostgreSQL
Yourmind, 2019-10-11 11:05:58

What does spring not like about the request?

my query is:
@Query("select a from Advertisements a where a.name = ?1 and ((?2>=0 and a.price<=?2) or (?3>=0 and a.price>=? 3)) and a.tag in %3 order by a.Numberviews DESC")
List findByFilterByNumberviews( String name, int topprice, int lowprice, Set tags);
Advertisements table:
@Entity
@Table(name = "Advertisements")
public class Advertisement {
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
// @Column(name="id")
private UUID idAdvertisement;//general registry number records
private int price;
private Stringname;
private String description;
//many ads belong to the same tag
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "idAdvertisement")
//there's one tag here - the most child
private Tag tag= new Tag();
...
error:
Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.example.NedoAvito.repository.AdvertisementRepository.findByFilterByNumberviews(java.lang.String,int,int,java.util.Set) !

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mayton2019, 2019-10-11
@mayton2019

Try to replace request on such
If fulfills OK - that add on one predicate. Consistently you will find which one is written incorrectly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question