Sergei10
(Sergei Stepanov)
February 27, 2013, 8:44am
1
Hi, everybody!
Please, help me.
I’ve just encountered a strange problem with querying Oracle database from my Vaadin project using FreeFormQuery.
So, my actions are:
Creating a
NativeSelect
;
Getting an SQLcontainer with a
FreeFormQuery
like “SELECT id, name FROM mytable ORDER BY name”;
Binding the data to my NativeSelect:
my_select.setContainerDataSource(my_SQL_container);
my_select.setItemCaptionPropertyId("NAME");
my_select.setImmediate(true);
Thats all. After that I get a NativeSelect with ordered data, but when I choose something (even without listener), I get an exception:
feb 27, 2013 1:04:57 PM com.vaadin.data.util.sqlcontainer.SQLContainer containsId
WARNING: containsId query failed
java.sql.SQLException: ORA-00933: SQL command not properly ended
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:590)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1973)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:850)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2599)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2963)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:653)
at com.vaadin.data.util.sqlcontainer.query.FreeformQuery.containsRowWithKey(FreeformQuery.java:411)
at com.vaadin.data.util.sqlcontainer.SQLContainer.containsId(SQLContainer.java:229)
at com.vaadin.data.util.sqlcontainer.SQLContainer.indexOfId(SQLContainer.java:596)
at com.vaadin.data.util.sqlcontainer.SQLContainer.getItem(SQLContainer.java:268)
at com.vaadin.data.util.sqlcontainer.SQLContainer.getContainerProperty(SQLContainer.java:245)
at com.vaadin.ui.AbstractSelect.getContainerProperty(AbstractSelect.java:753)
at com.vaadin.ui.AbstractSelect$CaptionChangeListener.addNotifierForItem(AbstractSelect.java:1739)
at com.vaadin.ui.AbstractSelect.paintContent(AbstractSelect.java:354)
at com.vaadin.ui.NativeSelect.paintContent(NativeSelect.java:85)
at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:781)
at com.vaadin.ui.AbstractOrderedLayout.paintContent(AbstractOrderedLayout.java:187)
at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:781)
at com.vaadin.ui.Panel.paintContent(Panel.java:269)
at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:781)
at com.vaadin.ui.AbstractOrderedLayout.paintContent(AbstractOrderedLayout.java:187)
at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:781)
at com.vaadin.ui.AbstractOrderedLayout.paintContent(AbstractOrderedLayout.java:187)
at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:781)
at com.vaadin.ui.AbstractOrderedLayout.paintContent(AbstractOrderedLayout.java:187)
at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:781)
at com.vaadin.ui.Panel.paintContent(Panel.java:269)
at com.vaadin.ui.Window.paintContent(Window.java:645)
at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:781)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.writeUidlResponce(AbstractCommunicationManager.java:1044)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.paintAfterVariableChanges(AbstractCommunicationManager.java:925)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:792)
at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:318)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Sergei10
(Sergei Stepanov)
February 27, 2013, 8:48am
2
I should add that if I get rid of “ORDER BY” clause in my query then everything works fine, but i need the data to be ordered!
Teppo.4
(Teppo Kurki)
February 27, 2013, 9:03am
3
When the containsId(ID) method is called, the FreeformQuery will attempt to add a WHERE clause to your query string, so it will become something like “SELECT foo FROM bar ORDER BY baz WHERE key=ID”. I’m guessing that such an ordering of the keywords is not allowed. You should look into implementing the FreeformStatementDelegate interface and especially the getContainsRowQueryStatement(Object… keys) method to deliver a syntactically correct query string to your database.
Curtis1
(Curtis Ropp)
March 1, 2013, 7:24pm
4
If the table you are quering from is small enough you can also do select * from ( select foo from bar order by bar) as grapes. This would keep you from having to implement the FreeFormStatementDelegate.
Pere3
(Pere Pasqual)
February 23, 2018, 8:43am
5
Just to inform: I am see this warning in my logs and, after doing some traces, it seems it’s not NativeSelect neither Oracle related in my case. It seems ole SQLContainer is the one to blame here again. When I scroll down in a Grid with a handful of rows and it tries to do some “lazy-loading”, it stops on this line. Buggy code, I suppose. Yeah, I’m aware that SQLContainer it’s been deprecated.