Class TableQuery
- java.lang.Object
-
- com.vaadin.v7.data.util.sqlcontainer.query.AbstractTransactionalQuery
-
- com.vaadin.v7.data.util.sqlcontainer.query.TableQuery
-
- All Implemented Interfaces:
QueryDelegate,QueryDelegate.RowIdChangeNotifier,Serializable
@Deprecated public class TableQuery extends AbstractTransactionalQuery implements QueryDelegate, QueryDelegate.RowIdChangeNotifier
Deprecated.As of 8.0, no replacement available.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTableQuery.RowIdChangeEventDeprecated.-
Nested classes/interfaces inherited from interface com.vaadin.v7.data.util.sqlcontainer.query.QueryDelegate
QueryDelegate.RowIdChangeListener, QueryDelegate.RowIdChangeNotifier
-
-
Constructor Summary
Constructors Modifier Constructor Description TableQuery(String tableName, JDBCConnectionPool connectionPool)Deprecated.Creates a new TableQuery using the given connection pool and table name to fetch the data from.TableQuery(String tableName, JDBCConnectionPool connectionPool, SQLGenerator sqlGenerator)Deprecated.Creates a new TableQuery using the given connection pool, SQL generator and table name to fetch the data from.TableQuery(String catalogName, String schemaName, String tableName, JDBCConnectionPool connectionPool, SQLGenerator sqlGenerator)Deprecated.Creates a new TableQuery using the given connection pool, SQL generator and table name to fetch the data from.protectedTableQuery(String catalogName, String schemaName, String tableName, JDBCConnectionPool connectionPool, SQLGenerator sqlGenerator, boolean escapeNames)Deprecated.Creates a new TableQuery using the given connection pool, SQL generator and table name to fetch the data from.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddListener(QueryDelegate.RowIdChangeListener listener)Deprecated.As of 7.0, replaced byaddRowIdChangeListener(QueryDelegate.RowIdChangeListener)voidaddRowIdChangeListener(QueryDelegate.RowIdChangeListener listener)Deprecated.Adds RowIdChangeListener to this query.voidbeginTransaction()Deprecated.Reserves a connection with auto-commit off if no transaction is in progress.voidcommit()Deprecated.Commits (if not in auto-commit mode) and releases the active connection.booleancontainsRowWithKey(Object... keys)Deprecated.Performs a query to find out whether the SQL table contains a row with the given set of primary keys.StringgetCatalogName()Deprecated.Returns the catalog name for the query.intgetCount()Deprecated.Generates and executes a query to determine the current row count from the DB.protected StringgetFullTableName()Deprecated.Returns the complete table name obtained by concatenation of the catalog and schema names (if any) and the table name.List<String>getPrimaryKeyColumns()Deprecated.Returns a list of primary key column names.ResultSetgetResults(int offset, int pagelength)Deprecated.Executes a paged SQL query and returns the ResultSet.StringgetSchemaName()Deprecated.Returns the catalog name for the query.SQLGeneratorgetSqlGenerator()Deprecated.StringgetTableName()Deprecated.Returns the table name for the query without catalog and schema information.StringgetVersionColumn()Deprecated.booleanimplementationRespectsPagingLimits()Deprecated.Allows the SQLContainer implementation to check whether the QueryDelegate implementation implements paging in the getResults method.voidremoveListener(QueryDelegate.RowIdChangeListener listener)Deprecated.As of 7.0, replaced byremoveRowIdChangeListener(QueryDelegate.RowIdChangeListener)booleanremoveRow(RowItem row)Deprecated.Removes the given RowItem from the database.voidremoveRowIdChangeListener(QueryDelegate.RowIdChangeListener listener)Deprecated.Removes the given RowIdChangeListener from this query.voidrollback()Deprecated.Rolls back and releases the active connection.voidsetFilters(List<Container.Filter> filters)Deprecated.Sets the filters to apply when performing the SQL query.voidsetOrderBy(List<OrderBy> orderBys)Deprecated.Sets the order in which to retrieve rows from the database.voidsetVersionColumn(String column)Deprecated.intstoreRow(RowItem row)Deprecated.Stores a row in the database.RowIdstoreRowImmediately(RowItem row)Deprecated.Inserts the given row in the database table immediately.-
Methods inherited from class com.vaadin.v7.data.util.sqlcontainer.query.AbstractTransactionalQuery
ensureTransaction, getConnection, isInTransaction, releaseConnection
-
-
-
-
Constructor Detail
-
TableQuery
public TableQuery(String tableName, JDBCConnectionPool connectionPool, SQLGenerator sqlGenerator)
Deprecated.Creates a new TableQuery using the given connection pool, SQL generator and table name to fetch the data from. All parameters must be non-null. The table name must be a simple name with no catalog or schema information. If those are needed, useTableQuery(String, String, String, JDBCConnectionPool, SQLGenerator).- Parameters:
tableName- Name of the database table to connect toconnectionPool- Connection pool for accessing the databasesqlGenerator- SQL query generator implementation
-
TableQuery
public TableQuery(String catalogName, String schemaName, String tableName, JDBCConnectionPool connectionPool, SQLGenerator sqlGenerator)
Deprecated.Creates a new TableQuery using the given connection pool, SQL generator and table name to fetch the data from. Catalog and schema names can be null, all other parameters must be non-null.- Parameters:
catalogName- Name of the database catalog (can be null)schemaName- Name of the database schema (can be null)tableName- Name of the database table to connect toconnectionPool- Connection pool for accessing the databasesqlGenerator- SQL query generator implementation- Since:
- 7.1
-
TableQuery
public TableQuery(String tableName, JDBCConnectionPool connectionPool)
Deprecated.Creates a new TableQuery using the given connection pool and table name to fetch the data from. All parameters must be non-null. The default SQL generator will be used for queries. The table name must be a simple name with no catalog or schema information. If those are needed, useTableQuery(String, String, String, JDBCConnectionPool, SQLGenerator).- Parameters:
tableName- Name of the database table to connect toconnectionPool- Connection pool for accessing the database
-
TableQuery
protected TableQuery(String catalogName, String schemaName, String tableName, JDBCConnectionPool connectionPool, SQLGenerator sqlGenerator, boolean escapeNames)
Deprecated.Creates a new TableQuery using the given connection pool, SQL generator and table name to fetch the data from. Catalog and schema names can be null, all other parameters must be non-null.- Parameters:
catalogName- Name of the database catalog (can be null)schemaName- Name of the database schema (can be null)tableName- Name of the database table to connect toconnectionPool- Connection pool for accessing the databasesqlGenerator- SQL query generator implementationescapeNames- true to escape special characters in catalog, schema and table names, false to use the names as-is- Since:
- 7.1
-
-
Method Detail
-
getCount
public int getCount() throws SQLExceptionDeprecated.Description copied from interface:QueryDelegateGenerates and executes a query to determine the current row count from the DB. Row count will be fetched using filters that are currently set to the QueryDelegate.- Specified by:
getCountin interfaceQueryDelegate- Returns:
- row count
- Throws:
SQLException
-
getResults
public ResultSet getResults(int offset, int pagelength) throws SQLException
Deprecated.Description copied from interface:QueryDelegateExecutes a paged SQL query and returns the ResultSet. The query is defined through implementations of this QueryDelegate interface.- Specified by:
getResultsin interfaceQueryDelegate- Parameters:
offset- the first item of the page to loadpagelength- the length of the page to load- Returns:
- a ResultSet containing the rows of the page
- Throws:
SQLException- if the database access fails.
-
implementationRespectsPagingLimits
public boolean implementationRespectsPagingLimits()
Deprecated.Description copied from interface:QueryDelegateAllows the SQLContainer implementation to check whether the QueryDelegate implementation implements paging in the getResults method.- Specified by:
implementationRespectsPagingLimitsin interfaceQueryDelegate- Returns:
- true if the delegate implements paging
- See Also:
QueryDelegate.getResults(int, int)
-
storeRow
public int storeRow(RowItem row) throws UnsupportedOperationException, SQLException
Deprecated.Description copied from interface:QueryDelegateStores a row in the database. The implementation of this interface decides how to identify whether to store a new row or update an existing one.- Specified by:
storeRowin interfaceQueryDelegate- Parameters:
row- The row to be stored or updated.- Returns:
- the number of affected rows in the database table
- Throws:
UnsupportedOperationException- if the implementation is read only.SQLException
-
storeRowImmediately
public RowId storeRowImmediately(RowItem row) throws SQLException
Deprecated.Inserts the given row in the database table immediately. Begins and commits the transaction needed. This method was added specifically to solve the problem of returning the final RowId immediately on the SQLContainer.addItem() call when auto commit mode is enabled in the SQLContainer.- Parameters:
row- RowItem to add to the database- Returns:
- Final RowId of the added row
- Throws:
SQLException
-
setFilters
public void setFilters(List<Container.Filter> filters) throws UnsupportedOperationException
Deprecated.Description copied from interface:QueryDelegateSets the filters to apply when performing the SQL query. These are translated into a WHERE clause. Default filtering mode will be used.- Specified by:
setFiltersin interfaceQueryDelegate- Parameters:
filters- The filters to apply.- Throws:
UnsupportedOperationException- if the implementation doesn't support filtering.
-
setOrderBy
public void setOrderBy(List<OrderBy> orderBys) throws UnsupportedOperationException
Deprecated.Description copied from interface:QueryDelegateSets the order in which to retrieve rows from the database. The result can be ordered by zero or more columns and each column can be in ascending or descending order. These are translated into an ORDER BY clause in the SQL query.- Specified by:
setOrderByin interfaceQueryDelegate- Parameters:
orderBys- A list of the OrderBy conditions.- Throws:
UnsupportedOperationException- if the implementation doesn't support ordering.
-
beginTransaction
public void beginTransaction() throws UnsupportedOperationException, SQLExceptionDeprecated.Description copied from class:AbstractTransactionalQueryReserves a connection with auto-commit off if no transaction is in progress.- Specified by:
beginTransactionin interfaceQueryDelegate- Overrides:
beginTransactionin classAbstractTransactionalQuery- Throws:
SQLException- if a connection could not be obtained or configuredUnsupportedOperationException
-
commit
public void commit() throws UnsupportedOperationException, SQLExceptionDeprecated.Description copied from class:AbstractTransactionalQueryCommits (if not in auto-commit mode) and releases the active connection.- Specified by:
commitin interfaceQueryDelegate- Overrides:
commitin classAbstractTransactionalQuery- Throws:
SQLException- if not in a transaction managed by this queryUnsupportedOperationException
-
rollback
public void rollback() throws UnsupportedOperationException, SQLExceptionDeprecated.Description copied from class:AbstractTransactionalQueryRolls back and releases the active connection.- Specified by:
rollbackin interfaceQueryDelegate- Overrides:
rollbackin classAbstractTransactionalQuery- Throws:
SQLException- if not in a transaction managed by this queryUnsupportedOperationException
-
getPrimaryKeyColumns
public List<String> getPrimaryKeyColumns()
Deprecated.Description copied from interface:QueryDelegateReturns a list of primary key column names. The list is either fetched from the database (TableQuery) or given as an argument depending on implementation.- Specified by:
getPrimaryKeyColumnsin interfaceQueryDelegate- Returns:
-
getVersionColumn
public String getVersionColumn()
Deprecated.
-
setVersionColumn
public void setVersionColumn(String column)
Deprecated.
-
getTableName
public String getTableName()
Deprecated.Returns the table name for the query without catalog and schema information.- Returns:
- table name, not null
-
getCatalogName
public String getCatalogName()
Deprecated.Returns the catalog name for the query.- Returns:
- catalog name, can be null
- Since:
- 7.1
-
getSchemaName
public String getSchemaName()
Deprecated.Returns the catalog name for the query.- Returns:
- catalog name, can be null
- Since:
- 7.1
-
getFullTableName
protected String getFullTableName()
Deprecated.Returns the complete table name obtained by concatenation of the catalog and schema names (if any) and the table name. This method can be overridden if customization is needed.- Returns:
- table name in the form it should be used in query and update statements
- Since:
- 7.1
-
getSqlGenerator
public SQLGenerator getSqlGenerator()
Deprecated.
-
removeRow
public boolean removeRow(RowItem row) throws UnsupportedOperationException, SQLException
Deprecated.Description copied from interface:QueryDelegateRemoves the given RowItem from the database.- Specified by:
removeRowin interfaceQueryDelegate- Parameters:
row- RowItem to be removed- Returns:
- true on success
- Throws:
UnsupportedOperationExceptionSQLException
-
containsRowWithKey
public boolean containsRowWithKey(Object... keys) throws SQLException
Deprecated.Description copied from interface:QueryDelegatePerforms a query to find out whether the SQL table contains a row with the given set of primary keys.- Specified by:
containsRowWithKeyin interfaceQueryDelegate- Parameters:
keys- the primary keys- Returns:
- true if the SQL table contains a row with the provided keys
- Throws:
SQLException
-
addRowIdChangeListener
public void addRowIdChangeListener(QueryDelegate.RowIdChangeListener listener)
Deprecated.Adds RowIdChangeListener to this query.- Specified by:
addRowIdChangeListenerin interfaceQueryDelegate.RowIdChangeNotifier- Parameters:
listener- listener to be added
-
addListener
@Deprecated public void addListener(QueryDelegate.RowIdChangeListener listener)
Deprecated.As of 7.0, replaced byaddRowIdChangeListener(QueryDelegate.RowIdChangeListener)- Specified by:
addListenerin interfaceQueryDelegate.RowIdChangeNotifier
-
removeRowIdChangeListener
public void removeRowIdChangeListener(QueryDelegate.RowIdChangeListener listener)
Deprecated.Removes the given RowIdChangeListener from this query.- Specified by:
removeRowIdChangeListenerin interfaceQueryDelegate.RowIdChangeNotifier- Parameters:
listener- listener to be removed
-
removeListener
@Deprecated public void removeListener(QueryDelegate.RowIdChangeListener listener)
Deprecated.As of 7.0, replaced byremoveRowIdChangeListener(QueryDelegate.RowIdChangeListener)- Specified by:
removeListenerin interfaceQueryDelegate.RowIdChangeNotifier
-
-