IllegalArgumentException: Value list does not match key list

Discuss all problems you have with Servoy here. It might help to mention the Servoy version and Operating System version you are using

IllegalArgumentException: Value list does not match key list

Postby rossent » Tue Jan 14, 2014 7:22 pm

Hi Servoy,

Sometimes when we use:

Code: Select all
plugins.rawSQL.notifyDataChange(realDBConnName, dbViewName, pkDS, SQL_ACTION_TYPES.UPDATE_ACTION);


to notify the clients that data in a database view is changed due to changes in some of the underlying tables, the result is false.
After that we get the error below in the Servoy server log:

Code: Select all
ERROR    com.servoy.j2db.util.Debug    Throwable    
java.lang.IllegalArgumentException: Value list does not match key list in set condition
     at com.servoy.base.query.BaseSetCondition.validateValues(BaseSetCondition.java:107)
     at com.servoy.j2db.query.SetCondition.acceptVisitor(SetCondition.java:103)
     at com.servoy.j2db.query.AbstractBaseQuery.acceptVisitor(AbstractBaseQuery.java:151)
     at com.servoy.j2db.query.AbstractBaseQuery.acceptVisitor(AbstractBaseQuery.java:127)
     at com.servoy.j2db.query.AndOrCondition.acceptVisitor(AndOrCondition.java:50)
     at com.servoy.j2db.query.AbstractBaseQuery.acceptVisitor(AbstractBaseQuery.java:151)
     at com.servoy.j2db.query.AbstractBaseQuery.acceptVisitor(AbstractBaseQuery.java:137)
     at com.servoy.j2db.query.QuerySelect.acceptVisitor(QuerySelect.java:661)
     at com.servoy.j2db.query.AbstractBaseQuery.setPlaceholderValue(AbstractBaseQuery.java:227)
     at com.servoy.j2db.query.AbstractBaseQuery.setPlaceholderValue(AbstractBaseQuery.java:221)
     at com.servoy.j2db.dataprocessing.RowManager.getRows(RowManager.java:498)
     at com.servoy.j2db.dataprocessing.FoundSetManager.notifyDataChange(FoundSetManager.java:2121)
     at com.servoy.j2db.dataprocessing.FoundSetManager.notifyDataChange(FoundSetManager.java:197)
     at com.servoy.extensions.plugins.rawSQL.RawSQLProvider.js_notifyDataChange(RawSQLProvider.java:319)
     at sun.reflect.GeneratedMethodAccessor501.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
     at java.lang.reflect.Method.invoke(Unknown Source)
     at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:158)
     at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:312)
     at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1774)
     at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:837)
     at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
     at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:624)
     at com.servoy.j2db.dataprocessing.FoundSet.executeFoundsetTriggerInternal(FoundSet.java:3995)
     at com.servoy.j2db.dataprocessing.FoundSet.executeFoundsetTrigger(FoundSet.java:3953)
     at com.servoy.j2db.dataprocessing.FoundSet.deleteRecord(FoundSet.java:3911)
     at com.servoy.j2db.dataprocessing.FoundSet.deleteRecord(FoundSet.java:3797)
     at com.servoy.j2db.dataprocessing.FoundSet.deleteRecord(FoundSet.java:2439)
     at com.servoy.j2db.dataprocessing.FoundSet.js_deleteRecord(FoundSet.java:2415)
     at sun.reflect.GeneratedMethodAccessor580.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
     at java.lang.reflect.Method.invoke(Unknown Source)
     at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:158)
     at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:312)
     at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1774)
     at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:837)
     at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
     at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:406)
     at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3204)
     at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:156)
     at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:624)
     at com.servoy.j2db.FormController.executeFunction(FormController.java:4990)
     at com.servoy.j2db.FormController.executeFunction(FormController.java:4872)
     at com.servoy.j2db.FormController.executeFunction(FormController.java:4739)
     at com.servoy.j2db.FormController$ScriptExecuter.executeFunction(FormController.java:4584)
     at com.servoy.j2db.ui.BaseEventExecutor.fireEventCommand(BaseEventExecutor.java:276)
     at com.servoy.j2db.ui.BaseEventExecutor.fireActionCommand(BaseEventExecutor.java:218)
     at com.servoy.j2db.server.headlessclient.dataui.WebEventExecutor.handleEvent(WebEventExecutor.java:463)
     at com.servoy.j2db.server.headlessclient.dataui.WebEventExecutor.onEvent(WebEventExecutor.java:404)
     at com.servoy.j2db.server.headlessclient.dataui.WebEventExecutor$2.onEvent(WebEventExecutor.java:184)
     at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:177)
     at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:312)
     at org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:157)
     at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
     at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1279)
     at org.apache.wicket.RequestCycle.step(RequestCycle.java:1358)
     at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1465)
     at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
     at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
     at com.servoy.j2db.server.servlets.Zt.doGet(Zt.java:10)
     at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:138)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
     at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
     at java.lang.Thread.run(Unknown Source)


What could be causing this error? The notification is invoked after successful save of data in the database.
Rossen Totev
Argos Software
rossent
 
Posts: 288
Joined: Wed Dec 31, 2008 2:03 pm

Re: IllegalArgumentException: Value list does not match key

Postby rgansevles » Wed Jan 15, 2014 1:17 pm

Rossen,

When SQL_ACTION_TYPES.UPDATE_ACTION is used code flow does not happen.
It can happen when SQL_ACTION_TYPES.INSERT_ACTION is used, do you do that and what is the contents of the pkds in that case?

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: IllegalArgumentException: Value list does not match key

Postby rossent » Wed Jan 15, 2014 6:50 pm

Yes, we do use SQL_ACTION_TYPES.INSERT_ACTION as well.

For some database views which use aggregated and grouped data we cannot determine exactly what the notification should be (because an UPDATE in some of the underlying table should actually result in an INSERT or UPDATE or even DELETE for the view - for example, a change of existing record in the table may result in a new group being added in the view, or adding a new record to the table may result to an "existing" record in the view to be updated) In such cases the only thing which we found that works and causes the client to refresh correctly their cached data from the view is to fire an INSERT notification followed by an UPDATE notification. In other words, it is possible that sometimes an INSERT notification is fired for a record which already "exists" in the database view.

The pkDS contains the values for the row_ident fields of the database views - these are not primary keys (because database views do not have those) but the unique, non-nullable fields configured in the dbi files which allow Servoy to locate individual records in the view.
Rossen Totev
Argos Software
rossent
 
Posts: 288
Joined: Wed Dec 31, 2008 2:03 pm

Re: IllegalArgumentException: Value list does not match key

Postby rgansevles » Wed Jan 22, 2014 10:37 am

Rossen,

I tried a small sample with INSERT (the only value that can cause this exception) and it works as expected.
The pkDS has to have a value of an array per record, each array consists of the pk values in alphabetical pk column name.
So when I have composite column i do: pkDS.addRow([val1, val2])

Code: Select all
   plugins.rawSQL.executeSQL('example_data','shippers','insert into shippers (shipperid, companyname) values (101, \'test\')')
   var pkDS = databaseManager.createEmptyDataSet()
   pkDS.addRow([101])
   plugins.rawSQL.notifyDataChange('example_data', 'shippers', pkDS, SQL_ACTION_TYPES.INSERT_ACTION);


Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: IllegalArgumentException: Value list does not match key

Postby rossent » Wed Jan 22, 2014 7:00 pm

This is exactly how we pass the PK values.
Did you try with a database view where you setup one or more columns as "row_ident"?
Rossen Totev
Argos Software
rossent
 
Posts: 288
Joined: Wed Dec 31, 2008 2:03 pm

Re: IllegalArgumentException: Value list does not match key

Postby deezzub » Wed Oct 08, 2014 8:41 am

deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany


Return to Discuss possible Issues and Bugs

Who is online

Users browsing this forum: No registered users and 19 guests

cron