【发布时间】:2018-01-03 19:30:10
【问题描述】:
我正在使用本机查询进行连接。返回的对象是一个包含查询中所有属性的新对象。但它会抛出一个错误,说它无法将 object[] 绑定到 CombinedObj。我该怎么办?
public interface SettingsRepository extends JpaRepository<Setting, Long> {
@Query(value = "select s.some_value, o.other_value from settings s inner join other_table o on o.id = s.other_table_id where user_id = :user_id", nativeQuery = true)
List<CombinedObj> find(@Param("user_id") int userId);
}
【问题讨论】: