0

I got an error when I insert JSONObject in DTO for the result query

Entity

@Entity
public class Inbound {
    @Id
    @Column(name = "manifestno_re")
    private String manifestNo;
    
    @Column(name = "manifestdate_re")
    private String manifestDate;
    
    @Column(name = "company_id_re")
    private String companyId;
    
    @Column(name = "driverscheduleId_re")
    private Integer DriverscheduleId;
    
    @Column(name = "childrenkoli_re")
    private JSONObject childrenkoli;
    }

when I run my project it give an error like my title. If I remove the childrenkoli_re, the program goes well

  • 1
    And what should `JSONObject` be mapped to? A varchar, blob, clob? There is no default mapping for that type, so you will need to create a usertype/converter yourself for this. Or better you probably shouldn't be storing the `JSONObject` but rather the `String` representation of that (but that is IMHO). – M. Deinum Oct 26 '21 at 07:20

1 Answers1

0

There is not any data type in the database which can directly store JSONObject so you need to specify the data type as varchar, blob, or clob or you can also modify the JSOObject in string and store it. You can see here

Neeraj
  • 121
  • 3