In my springboot project, I need to run a jpa query on a Table and store the result Object in a different class object. Is it a right way? Are there any simple ways to do this..
The JPA Repository method is : @query("select date, sum(crAmt), sum(drAmt) from Daybook u where u.date = ?1")
public DaybookBalance findDaybookBalance(String d1);
@Table(name="daybook")
public class Daybook implements Comparable<Daybook>{
@Id
@Column(name="dbid")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long dbId;
private int sNo;
private String date;
private String narration;
private int acccode;
private Double drAmt;
private Double crAmt;
private int sktValue;
public class DaybookBalance {
private String date;
private long crTot;
private long drTot;
I got the following error
: No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [in.trident.crdr.entities.DaybookBalance], mergedContextConfiguration = [MergedContextConfiguration@51dcb805 testClass = UserRepositoryTests, locations = '{}', classes = '{class in.trident.crdr.CrDrReportApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTestContextBootstrapper=true}', contextCustomizers = set[[ImportsContextCustomizer@66498326 key = [org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration, org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration, org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration