简体   繁体   中英

Spring data Derived Queries with Multiple Condition and one parameter

How can I create a derived query methods in Spring data which select result based on multiple conditions but with only one parameter.

List<Entity> findById1OrId2OrId3(String id1OrId2OrId3);

Something like this example.

I don't think it is possible with derived queries.

Alternatively,

@Query("from Entity e where e.id1 = ?0 or e.id2 = ?0 or e.id3 = ?0")
List<Entity> findById1OrId2OrId3(String singleId);

您可以使用“In”并制作 ID 列表,然后进行新的派生查询以实现此目的

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM