FreeformQuery returns always empty

Hi everyone!

I’m trying to display a table with all the user that I have saved in my Oracle database, but always I’m getting empty results. I don’t know what is exactly the problem because if I execute of the FreeformQuery (select * FROM USERS) directly by command it returned that I want.

Does not give any error, just returns me an empty table! What is my error? Please help me!

 [code]

JDBCConnectionPool connectionPool = null;
try {
connectionPool = new SimpleJDBCConnectionPool(“oracle.jdbc.OracleDriver”,
“jdbc:oracle:thin:@localhost:1521:xe”, “user”, “userpass”, 2, 5);
}
catch (SQLException e) {
e.printStackTrace();
}

    SQLContainer container = null;
    //TableQuery tq = new TableQuery("USERS", connectionPool,new OracleGenerator());
    //tq.setVersionColumn("VERSION");
    //tq.setVersionColumn("OPTLOCK");
    try {
        container = new SQLContainer(new FreeformQuery("select * FROM USERS" , connectionPool,"USER_ID"));
       
    } catch (SQLException e) {            
        e.printStackTrace();
    }
      table_1 = new Table(null, container);
      table_1.setWidth("100%");
      table_1.setHeight("170px");
      table_1.setSelectable(true);
      table_1.setMultiSelect(true);

      table_1.setContainerDataSource(container);

[/code]Thanks in advance!

Hey Pedro,

Have you read through this?
https://vaadin.com/tutorial/sql/-/section/preface.html

Hi Joacim,

Yes, I tried to follow this tutorial and supposedly my solution should work but it always returns empty…

Thanks!

Hmm, try debugging the code; look what the query returns, and/or whether or not the container “contains” any items?