0

I have a user work table it contain lot of things.But I want to find how many pieces of material taken by user through userId, But My Custom query not able to work what I want. My table Name Is User_work It contain 6 column. pieces and userId these two column present inside this table this is my custom Query

package com.nilmani.workmanagement.repository

import com.nilmani.workmanagement.entity.UserWork
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Query
import org.springframework.web.bind.annotation.RequestParam

interface MaterialReturnRepository : JpaRepository<MaterialReturnRepository,Long> {
    @Query("select u from UserWork where u.pieces =?  u.userId=userId")
    fun findTotalPiecesOfMaterial(@RequestParam(" pieces")pieces:Long,@RequestParam("userId")userId:Long):UserWork
}

I face issue while create select SQL QUERY

Mama
  • 237
  • 3
  • 16
  • yoir query sloud look like `select u.* from UserWork u where u.pieces =:pieces AND u.userId=:userId` but i thpough t your strucute would look more like https://stackoverflow.com/questions/23008926/how-to-use-prepared-statement-in-jpa – nbk Oct 23 '21 at 12:25

0 Answers0