title: Determine response entity length
body: <p>Here I'm calling api to fill specifc data on it , I'm using <code>HTTP post</code> request with <code>JPA</code>, I'm getting trouble sometimes the response is too large <code>value too large for column</code>, I made a small lookeup to check from response size but my problem here each time the lookup will check from from length of response body,
  is there any idea to handle it with excption once it throws ?</p>
  
  <pre><code>@SpringBootApplication
  public class AutoDialerApplication implements CommandLineRunner {
  
      private static final Logger logger = LoggerFactory.getLogger(AutoDialerApplication.class);
      @Autowired
  
      private Bulk_repositoryRepository bulk_repositoryRepository;
  
  
      public static void main(String[] args) {
          SpringApplication.run(AutoDialerApplication.class);
      }
  
      @Override
      public void run(String... args) throws Exception {
          RestTemplate restTemplate = new RestTemplate();
          HttpHeaders headers = new HttpHeaders();
          headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
          headers.setBasicAuth("user", "pass");
  
          while(true) {
              //Convert to Oracle Date Format
              SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
              Date currentDate = new Date();
              String strDate = sdfDate.format(currentDate);
              // dateTwoDaysAgo..
              Calendar cal = Calendar.getInstance();
              cal.add(Calendar.DATE, -3);
              Date dateTwoDaysAgo = cal.getTime();
  
              logger.info("Just Started"); 
              for (Bulk_repository churnss : bulk_repositoryRepository.findAllByStatusAndCampTypeAndCampStartDateBetween(0,2,dateTwoDaysAgo,currentDate)) {
                  System.out.print(churnss);
                  logger.info(churnss.toString());
                  BulkAutoDialer AddOffer = new BulkAutoDialer(strDate,"1", churnss.getParam1(),churnss.getMsisdn());
  
                  logger.info(AddOffer.toString());
                  HttpEntity&lt;BulkAutoDialer&gt; entity = new HttpEntity&lt;BulkAutoDialer&gt;(AddOffer,headers);
  
                  ResponseEntity&lt;String&gt; responseEntity = restTemplate.exchange(
                          "https ...", HttpMethod.POST, entity, String.class);
  
                  if(responseEntity.getStatusCode() == HttpStatus.OK){
                      String response = responseEntity.getBody();
                      System.out.println(response);
                      if(responseEntity.getBody().length() &lt; 3 ) {
                      churnss.setFulfilment_status(response);
                      }else {
                          churnss.setFulfilment_status(" \"-10\" ");
                      }
                      churnss.setStatus(1);
                      churnss.setProcessDate(new Date());
                      logger.info(churnss.toString() + ", Response: " + response);
                      bulk_repositoryRepository.save(churnss);
                  }else {
                      logger.warn("Record Id: " + churnss.getId() + ", Http Failed Response: " + responseEntity.getStatusCode());
                  }
              }
              Thread.sleep(1000);
          }
      }
  
  }
  </code></pre>
  
  <p>here my loopkup :</p>
  
  <pre><code>if(responseEntity.getStatusCode() == HttpStatus.OK){
    String response = responseEntity.getBody();
    System.out.println(response);
    if(responseEntity.getBody().length() &lt; 3 ) {
    churnss.setFulfilment_status(response);
   }else {
   churnss.setFulfilment_status(" \"-10\" ");
                          }
   churnss.setStatus(1);
   churnss.setProcessDate(new Date());
   logger.info(churnss.toString() + ", Response: " + response);
   bulk_repositoryRepository.save(churnss);
  </code></pre>