KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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) <changeSet author="gcardoso" id="2012082707"> <insert tableName="t_user"> <column name="login" value="${ExcelValue1}"/> <column name="name" value="${ExcelValue2}}"/> <column name="password" value="${ExcelValue3}"/> </insert> <insert tableName="t_user"> <column name="login" value="${ExcelValue4}"/> <column name="name" value="${ExcelValue5}}"/> <column name="password" value="${ExcelValue6}"/> </insert> ... </changeSet> Is there any way that I could do something like this: HashMap<String, ArrayList<String>> values = new HashMap<String, ArrayList<String>>(); values.put("col1", Column1); values.put("col2", Column2); values.put("col3", Column3); liqui.setChangeLogParameters(values); <changeSet author="gcardoso" id="2012082707"> <insert tableName="t_user"> <column name="login" value="${Column1}"/> <co
Tags (comma-separated)
Save Edits
Cancel