Thursday 15 January 2015

java - Vaadin MySQL fetch -


I do not understand how to set up database results using the daydream. First I do:

  JDBCconnection pool pool = zero; {Pool = Try the new Simple JDBCConnectionPool (dbClass, dbUrl, "root", "toor"); } Hold (SQLException e) {e.printstaxtrace (); } FreeFormantic Query = New Freeformize (query_sus, pool, "id"); {Try SQLContainer Container = New SQLContainer (Query); } Hold (SQLException e) {e.printstaxtrace (); }   

And now what should I do? ( query_s is a simple query string, like SELECT * FROM users) I'm trying to use Freeformstatementdelegate, but I do not know how to use it. Is it the best choice for a code like above?

If you want to read only the database, you will get the free format declaration There is no need to use.

You can simply set them in the table:

  table table = new table (); Table.setContainerDataSource (sqlContainer);   

Or set the result in the list:

  list & lt; String & gt; List = New Arrestist & lt; String & gt; (); (Object object: sqlContainer.getItemIds ()) {list.add (sqlContainer.getItem (ob) .getItemProperty (columnName) .getValue ()); }   

But if you want to facilitate filtering, sorting, deletion and lazy loading, you should use the FreeformStatementDelegate .

1) Create a custom class;
2) Implementation FreeFormatament Deliget interface and override methods;
3) Set Free FormMicloidSetDeliget (new custom class);


No comments:

Post a Comment