-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New JobParameter Types Required [BATCH-1581] #1983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Dave Syer commented You can use Spring EL to make objects of an explicit type, e.g. "#{new Integer('1')}", or "#{T(my.company.MyEnum).valueOf('FOO')}". In the light of that I am reluctant to add more complications to the JobParameters (mainly because of the persistence requirements). |
Tomasz Blachowicz commented EL is great, but I'm not sure if it can be used with Spring 2.5 setup, that I deal with currently. BTW, how would Spring EL work with JobParameter? Is this something like "#{new Integer(#{jobParameters[intAsString]})}"? I've implemented some changes to Spring Batch Core to provide support for Integer and Boolean types. IT seems that it works OK. For the persistence I use existing columns. In case the parameter is of type Integer the value is stored in LONG_VAL column and the Boolean value is stored in STRING_VALUE. What is your opinion on such approach? |
Dave Syer commented Thanks for trying it out. I just don't think we should put any effort into supporting Spring 2.5 when those features are obsolete with the current version of the framework (3.0). With Spring 2.5 it should still work if you initialise your map values with inner bean definitions, e.g.
It's not pretty, but it works and it's really a corner case. |
Dave Syer commented Or even (slightly prettier):
|
Tomasz Blachowicz commented Dave, thanks for the explanation. I have already used that approach with java.lang.Integer.valueOf as factory method. |
This commit also changes the way job parameters are parsed and persisted. NB: This commit should ideally have been split into two change sets. But the changes are tightly related that is was not possible to separate them. Related to: * spring-projects#3960 * spring-projects#2122 * spring-projects#1035 * spring-projects#1983
This commit also changes the way job parameters are parsed and persisted. NB: This commit should ideally have been split into two change sets. But the changes are tightly related that is was not possible to separate them. Related to: * spring-projects#3960 * spring-projects#2122 * spring-projects#1035 * spring-projects#1983
This commit also changes the way job parameters are parsed and persisted. NB: This commit should ideally have been split into two change sets. But the changes are tightly related that is was not possible to separate them. Related to: * spring-projects#3960 * spring-projects#2122 * spring-projects#1035 * spring-projects#1983
Tomasz Blachowicz opened BATCH-1581 and commented
Currently there is support only for the limited number of types of JobParameter. It is required that other primitive types such as Integer or Boolean are supported as well.
This would particularly useful when dealing with readers such as HibernateCursorItemReader. The reader can gives ability to provide the parameters to be bound to the query (prepared statement parameters). However there is no straightforward way to provide the Integer of Boolean values for parameters that causes the reader to fail with ClassCastException. This is because the Spring injection mechanism doesn't have a chance to convert the values as it would do for regular properties.
It would be also useful to have implementation of enum JobParameters.
No further details from BATCH-1581
The text was updated successfully, but these errors were encountered: