+1 for having different name of setter. Having overloaded setter could cause confusion to BeanUtils. I would suggest two options: 1. Accept a json of column to POJO mappings 2. Explore bean utils to set list of objects from properties file. This is little tricky, you might have to write your own converter function.
-Priyanka On Mon, Nov 7, 2016 at 8:06 PM, Munagala Ramanath <[email protected]> wrote: > Try changing *setFieldInfo* to* setFieldInfoItem* > > Ram > > On Mon, Nov 7, 2016 at 4:23 AM, Hitesh Kapoor <[email protected]> > wrote: > > > Hi All, > > > > > > Currently in JdbcPOJOInsertOuput operator we cannot configure > JdbcFieldInfo > > via properties.xml and the user has to do the necessary coding in his > > application. > > To start solving this issue I followed the steps mentioned on > > http://docs.datatorrent.com/application_packages/#operator-properties > > > > And added the following code in AbstractJdbcPOJOOutputOperator (just for > > learning/testing) > > > > public void setFieldInfo(int index, String value) > > { > > LOG.info("In setting field info"); > > JdbcFieldInfo jvalue = new JdbcFieldInfo(); > > StringTokenizer st = new StringTokenizer(value); > > jvalue.setColumnName(st.nextToken()); > > jvalue.setPojoFieldExpression(st.nextToken()); > > jvalue.setType(FieldInfo.SupportType.valueOf(st.nextToken())); > > jvalue.setSqlType(Integer.parseInt(st.nextToken())); > > > > final int need = index - fieldInfos.size() + 1; > > for (int i = 0; i < need; i++) { > > fieldInfos.add(null); > > } > > fieldInfos.set(index, jvalue); > > } > > > > In my corresponding application I added the following lines in > > properties.xml: > > <property> > > <name>dt.operator.jdbcOutput.fieldInfo[0]</name> > > <value>customerPhone customerPhone STRING 0</value> > > </property> > > //Added similar properties for remaining field infos. > > > > > > The issue I am facing is that setFieldInfo() is not being called. Am I > > missing something? > > > > Regards, > > Hitesh > > >
