U voert dus query's uit op native query's, dus u moet nativeQuery =true . doorgeven argument opvragen. U moet ook @Repository . toevoegen annotatie in TransictionRepository koppel. Dat is niets anders dan je Dao-laag.
package com.overflow.overflow.service;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.overflow.overflow.models.Transictions;
@Repository
public interface TransictionRepository extends JpaRepository<Transictions, Long> {
@Query(nativeQuery = true,
value = "SELECT transiction.user_id, transiction.quantity,transiction.instrument_name, transiction.Price,instrument.LTP"
+ "FROM instrument"
+ "INNER JOIN transiction"
+ "ON instrument.instrument=transiction.instrument_name")
public List<Object[]> getTransictionsAndInstruments();
}