title: How to make null must error if input is empty in mybatis?
body: <p>Im trying to insert empty data and it must error but its still saving.
  I try try/cath and if statement if null and still not working.
  Can anyone suggest how to do it?</p>
  <p>Output in this image <a href="https://i.stack.imgur.com/wDL5S.png" rel="nofollow noreferrer">RPCbloom</a></p>
  <p>This project is Spring-boot with GRPC and MyBatis.</p>
  <pre><code>package com.cartservice.Repository;
  
  import java.util.List;
  
  import org.apache.ibatis.annotations.Delete;
  import org.apache.ibatis.annotations.Insert;
  import org.apache.ibatis.annotations.Mapper;
  import org.apache.ibatis.annotations.Options;
  import org.apache.ibatis.annotations.Result;
  import org.apache.ibatis.annotations.Results;
  import org.apache.ibatis.annotations.Select;
  import org.apache.ibatis.annotations.Update;
  
  import com.cartservice.Model.Client;
  import com.cartservice.Model.ProductEntity;
  import com.grpcserver.product.ProductServer.Product;
  
  @Mapper
  public interface ProductDAO {
      
      
      @Insert(&quot;INSERT INTO tb_product(purchase_item,  productname, productbrand,productprice,productdescription,productquantity,productexpirationdate) &quot; +
                &quot; VALUES (#{purchase_item}, #{productname}, #{productbrand}, #{productprice}, #{productdescription}, #{productquantity}, #{productexpirationdate} )&quot;)
  @Options(useGeneratedKeys = true, keyColumn = &quot;purchase_item&quot;, keyProperty = &quot;purchase_item&quot;)
      public int insert(ProductEntity  productEntity);
      
      
      
       
  }
  
  </code></pre>
  <pre><code>    @Override
      public void insert(Product request, StreamObserver&lt;APIResponse&gt; responseObserver) {
  
      
      ProductEntity productEntity = new ProductEntity();
  
      
      productEntity.setPurchase_item(request.getPurchaseItem());
      productEntity.setProductname(request.getProductname());
      productEntity.setProductbrand(request.getProductbrand());
      productEntity.setProductprice(request.getProductprice());
      productEntity.setProductdescription(request.getProductdescription());
      productEntity.setProductquantity(request.getProductquantity());
      productEntity.setProductexpirationdate(dateConvert.getDateFromDateProto(request.getProductexpirationdate()));
  
  
      productServiceImpl.saveDataFromDTO(productEntity);
      APIResponse.Builder  responce = APIResponse.newBuilder();
      responce.setResponseCode(0).setResponsemessage(&quot;Succefull added to database &quot; +productEntity);
      
      responseObserver.onNext(responce.build());
      responseObserver.onCompleted(); 
          
      
      
          
      }
  
  </code></pre>