Inserting values for initial database content using LiquiBase and Spring

I’m trying to add a lot of records (currently located in an Excel file) into my DB using Liquibase (so that I know how to do it for future DB changes)

My idea was to read the excel file using Java, and then fill the ChangeLogParameters from my Spring initialization class like this:

    SpringLiquibase liqui = new SpringLiquibase();
    liqui.setBeanName(“liquibaseBean”);
    liqui.setDataSource(dataSource());
    liqui.setChangeLog(“classpath:changelog.xml”);
       
    HashMap<String, String> values = new HashMap<String, String>();
    values.put(“line1col1”, ExcelValue1);
    values.put(“line1col2”, ExcelValue2);
    values.put(“line1col3”, ExcelValue3);
    values.put(“line2col1”, ExcelValue4);
    values.put(“line2col2”, ExcelValue5);
    values.put(“line2col3”, ExcelValue6);
    …
    liqui.setChangeLogParameters(values);



The problem with this approach is that my changelog.xml would be very strange (and non productive)



   
       
           
           
           
       
       
           
           
           
       
        …
   
   
   
Is there any way that I could do something like this:


    HashMap<String, ArrayList> values = new HashMap<String, ArrayList>();
    values.put(“col1”, Column1);
    values.put(“col2”, Column2);
    values.put(“col3”, Column3);
    liqui.setChangeLogParameters(values);

   
       
           
           
           
       
   


Or is there any other way?


After a while without any ideas on how to do this, I’m considrering the option to convert the Excel into a CSV file and import the data using

   

       
           
           
       
       
       
       
           
           
       
       
   
   


with these CSV files:

entity.csv

    SHORTNAME,DESCRIPTION
    nome1,descricao1
    nome2,descricao2

client.csv

    DESCRIPTION,ENTITY_REFERENCE
    descricaoCliente1,nome1
    descricaoCliente2,nome2

But I get this error:

    liquibase.exception.DatabaseException: Error executing SQL INSERT INTO T_CLIENT (DESCRIPTION, ENTITY_REFERENCE) VALUES (‘descricaoCliente1’, ‘nome1’): Unknown column ‘ENTITY_REFERENCE’ in 'field list’

If I change the header of my client.csv to  DESCRIPTION,ENTITYID I get this error:

    liquibase.exception.DatabaseException: Error executing SQL INSERT INTO T_CLIENT (DESCRIPTION, ENTITYID) VALUES (‘descricaoCliente1’, ‘nome1’): Incorrect integer value: ‘nome1’ for column ‘entityid’ at row 1


I any of these cases, it looks like defaultValueComputed doesn’t work in the same way as valueComputed in the following example

   

       
            nome1
            descricao1
       
   
       
           
            descricaoCliente
       
   
   


Is this the expected behavior?  Bug of LiquiBase?  Or just me doing something wrong (the most likely) ?

Or is there any other way to import massive amount of data?