Directory

← Back

Vaadin SQLContainer

Vaadin SQLContainer is a container implementation that reads it's contents from a JDBC data source.

Author

Rating

Vaadin SQLContainer is meant as a replacement to the old QueryContainer and supports lazy loading and buffered writes.

Two modes of operation are supportedFreeformQuery and TableQuery:

FreeformQuery mode allows you to specify any complex query and have it's results populate the container, however you need to impelment support for writing, sorting, filtering and lazy loading by implementing the FreeformQueryDelegate interface.

TableQuery mode allows you to provide only a table name and the container takes care of populating itself and automatically supports writing, sorting, filtering and lazy loading for the following database engines: HSQLDB, MySQL, MSSQL, Oracle and PostgreSQL.


SQLContainer has been integrated into Vaadin 6.7 and this add-on will not receive any further updates. All changes will be made to the Vaadin Framework only.


Sample code

try {
    connectionPool = new SimpleJDBCConnectionPool(
            "org.hsqldb.jdbc.JDBCDriver",
            "jdbc:hsqldb:mem:sqlcontainer", "SA", "", 2, 2);
    SQLContainer container = new SQLContainer(new FreeformQuery(
            "SELECT * FROM people", Arrays.asList("ID"), connectionPool));
    Table table = new Table("People", container);
} catch (SQLException e) {
    // Handle error
    e.printStackTrace();
}
try {
    connectionPool = new SimpleJDBCConnectionPool(
            "org.hsqldb.jdbc.JDBCDriver",
            "jdbc:hsqldb:mem:sqlcontainer", "SA", "", 2, 2);
    FreeformQuery query = new FreeformQuery("SELECT * FROM people",
            Arrays.asList("ID"));
    query.setDelegate(myFreeformQueryDelegateImplementation);
    SQLContainer container = new SQLContainer(query, connectionPool);
    Table table = new Table("People", container);
} catch (SQLException e) {
    // Handle error
    e.printStackTrace();
}

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Bug fixes

Released
2011-05-06
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 6.0+
Vaadin 6.6+ in 1.1.0
Browser
Browser Independent

Vaadin Add-on Directory

Find open-source widgets, add-ons, themes, and integrations for your Vaadin application. Vaadin Add-on Directory
The channel for finding, promoting, and distributing Vaadin add-ons.
Online