Исключение:
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [model.pojo.CarPrice]
Имеют 2 таблицы
+------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------------+--------------+------+-----+---------+----------------+
| car_id | int(11) | NO | PRI | NULL | auto_increment |
| car_brand | varchar(255) | NO | | NULL | |
| car_model | varchar(255) | YES | | NULL | |
| car_plate_number | varchar(255) | NO | | NULL | |
| car_type | varchar(255) | YES | | NULL | |
+------------------+--------------+------+-----+---------+----------------+
и
+---------------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+-------------+------+-----+---------+----------------+
| car_rent_details_id | int(11) | NO | PRI | NULL | auto_increment |
| cost_per_day | double | YES | | NULL | |
| rent_start_date | varchar(20) | YES | | NULL | |
| rent_end_date | varchar(20) | YES | | NULL | |
| car_info_id | int(11) | NO | UNI | NULL | |
| avaliable_to_rent | tinyint(1) | YES | | NULL | |
+---------------------+-------------+------+-----+---------+----------------+
Я пытаюсь получить все данные из Car и части CarRentDetails
в моем carRepository
@Repository
public interface CarRepository extends JpaRepository<Car, Integer> {
String ALL_AVAILIABLE_CAR_LIST_PRICE = " SELECT c.car_id, c.car_brand, c.car_model,
c.car_plate_number, c.car_type, crd.cost_per_day, crd.avaliable_to_rent " +
" FROM car_info c " +
" JOIN car_rent_details crd" +
" ON c.car_id = crd.car_rent_details_id" +
" AND crd.avaliable_to_rent = true ";
@Query(value = ALL_AVAILIABLE_CAR_LIST_PRICE, nativeQuery = true)
List<CarPrice> findAllByAvaliablePrice();
Попытка сопоставить это с моим классом POJO:
public class CarPrice {
private Integer carId;
private String carBrand;
private String carModel;
private String carPlateNumber;
private CarType carType;
private double costPerDay;
private boolean avaliableToRent;
+ getters, setters, to string
Как я могу сопоставить Объекты из этого Запроса?