'Angular & Spring Boot - Parse text file an save to MySQL

Now I'm working with Angular & Spring Boot project, I've searched all over the problems and no solution found. My goal is to upload a text file which has data. I want to parse every line and then call a service from backend to save data in a specific column. Meaning that my goal is not to upload the file to database it's to parse the lines and then save those lines (data) to database

This is my file.txt structure:

1234;06/07/22;06/07/22;VRT;  ;31070;some String content;some String content; ;147.10;A;1234
.....

here, my line has delimiter (;) those data are columns in MySQL.

Here is my entity:

  @CreationTimestamp
  @Temporal(TemporalType.DATE)
  private Date dateOperation;
  @CreationTimestamp
  @Temporal(TemporalType.DATE)
  private Date dateValue;
  private String rib;
  private String numCheck;
  private String operationNature;
  private BigDecimal montant;
  private String creditDebit;
  private long refCd;
  private long refPaiment;
  private String modePaiment;

So when I parse the line and save to databse data should be persisted this way:

1234 is refCd
06/07/22 is dateOperation
06/07/22 is dateValue
31070: rib
some string content: modePaiment
some string content : numCheck
147.10 : montant
A : creditDebit
1234: refPaiment


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source