I have Issue With JPA I am Geeting Issue While Executing The Query SQL Error: 0, SQLState: 42601,ERROR: syntax error at or near "$1"
@Entity
@Table(name="vechile_master")
public class VehicleMaster extends Auditable<Long>{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@OneToOne
@JoinColumn(name="device_id",referencedColumnName = "id")
private DeviceMaster deviceId;
}
@Repository
public interface VehicleMasterRepo extends JpaRepository<VehicleMaster,Integer>{
@Query(value="select * from VehicleMaster vm where vm.device_id :deviceId",nativeQuery = true)
public Object[][] getByDeviceId(@Param("deviceId")int deviceId);
}
CodePudding user response:
This statement is missing an equal sign
select * from VehicleMaster vm where vm.device_id = :deviceId