简体   繁体   中英

Is there any way, to get specific columns from DATA JPA , using @Query annotation in spring boot application

I am Using JPARespository to perform Database operations. I have a requirement, where I want to select specific columns from given table while passing a few where clause.

You can use projections . Spring Data will select only required columns. It works with both generated queries from method name and @Query annotation.

Related question: Spring Data JPA Projection selected fields from the DB

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