Convert string from property to list to pass it to SQL in XML Bean

27 views Asked by At

Hi I have an XML bean code where I am getting a property which is a string with some country names separated by commas I want to pass it to the SQL I have written in the code I write a single country I am having no issues but when I write business_unit = USA, BIS I am getting 0 results as it is taking the whole thing as a single string but I want to check the single value at a time.

<bean id="LNAccountUpsertSFDCIDSql"
      class="com.salesforce.dataloader.dao.database.SqlConfig" scope="singleton">
<property name="sqlString">
<value>
             SELECT /*+ PARALLEL(auto) */  DISTINCT
                    --Some SQL Code 
                WHERE  BUSINESS_UNIT__C  in 
                ('USA','BIS','BLSS','Australia','Hong Kong','India','Malaysia','New Zealand','Singapore','United Kingdom')
                --Some SQL Code
</value>
</property><property name="sqlParams">
<map>
<entry key="process.lastRunDate" value="java.sql.Timestamp"/>
<entry key="BusinessUnit03" value="java.sql.List"/>
</map>
</property>

</bean>


<bean id="LNAccountUpsertSFDCID"
      class="com.salesforce.dataloader.dao.database.DatabaseConfig"
      scope="singleton">
<property name="sqlConfig" ref="LNAccountUpsertSFDCIDSql"/>
<property name="dataSource" ref="dbDataSource"/>
</bean>

I am expecting to fetch that property in map with the correct values instead taking as whole string I want to check for each record.

Instead of hardcoding this value:

WHERE  BUSINESS_UNIT__C  in 
    ('USA','BIS','BLSS','Australia',
     'Hong Kong','India','Malaysia',
     'New Zealand','Singapore','United Kingdom')

I want to pass it through property file.

I tried the following solution:

value="#{T(org.springframework.util.StringUtils).commaDelimitedListToSet('${BusinessUnit03}').toList()}"

value="#{T(org.springframework.util.StringUtils).commaDelimitedListToSet('USA,BIS').toList()}"
0

There are 0 answers