|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.data.util.sqlcontainer.query.AbstractTransactionalQuery
com.vaadin.data.util.sqlcontainer.query.TableQuery
public class TableQuery
Nested Class Summary | |
---|---|
static class |
TableQuery.RowIdChangeEvent
Simple RowIdChangeEvent implementation. |
Nested classes/interfaces inherited from interface com.vaadin.data.util.sqlcontainer.query.QueryDelegate |
---|
QueryDelegate.RowIdChangeListener, QueryDelegate.RowIdChangeNotifier |
Constructor Summary | |
---|---|
|
TableQuery(java.lang.String tableName,
JDBCConnectionPool connectionPool)
Creates a new TableQuery using the given connection pool and table name to fetch the data from. |
|
TableQuery(java.lang.String tableName,
JDBCConnectionPool connectionPool,
SQLGenerator sqlGenerator)
Creates a new TableQuery using the given connection pool, SQL generator and table name to fetch the data from. |
|
TableQuery(java.lang.String catalogName,
java.lang.String schemaName,
java.lang.String tableName,
JDBCConnectionPool connectionPool,
SQLGenerator sqlGenerator)
Creates a new TableQuery using the given connection pool, SQL generator and table name to fetch the data from. |
protected |
TableQuery(java.lang.String catalogName,
java.lang.String schemaName,
java.lang.String tableName,
JDBCConnectionPool connectionPool,
SQLGenerator sqlGenerator,
boolean escapeNames)
Creates a new TableQuery using the given connection pool, SQL generator and table name to fetch the data from. |
Method Summary | |
---|---|
void |
addListener(QueryDelegate.RowIdChangeListener listener)
Deprecated. As of 7.0, replaced by addRowIdChangeListener(com.vaadin.data.util.sqlcontainer.query.QueryDelegate.RowIdChangeListener) |
void |
addRowIdChangeListener(QueryDelegate.RowIdChangeListener listener)
Adds RowIdChangeListener to this query |
void |
beginTransaction()
Reserves a connection with auto-commit off if no transaction is in progress. |
void |
commit()
Commits (if not in auto-commit mode) and releases the active connection. |
boolean |
containsRowWithKey(java.lang.Object... keys)
Performs a query to find out whether the SQL table contains a row with the given set of primary keys. |
java.lang.String |
getCatalogName()
Returns the catalog name for the query. |
int |
getCount()
Generates and executes a query to determine the current row count from the DB. |
protected java.lang.String |
getFullTableName()
Returns the complete table name obtained by concatenation of the catalog and schema names (if any) and the table name. |
java.util.List<java.lang.String> |
getPrimaryKeyColumns()
Returns a list of primary key column names. |
java.sql.ResultSet |
getResults(int offset,
int pagelength)
Executes a paged SQL query and returns the ResultSet. |
java.lang.String |
getSchemaName()
Returns the catalog name for the query. |
SQLGenerator |
getSqlGenerator()
|
java.lang.String |
getTableName()
Returns the table name for the query without catalog and schema information. |
java.lang.String |
getVersionColumn()
|
boolean |
implementationRespectsPagingLimits()
Allows the SQLContainer implementation to check whether the QueryDelegate implementation implements paging in the getResults method. |
void |
removeListener(QueryDelegate.RowIdChangeListener listener)
Deprecated. As of 7.0, replaced by removeRowIdChangeListener(com.vaadin.data.util.sqlcontainer.query.QueryDelegate.RowIdChangeListener) |
boolean |
removeRow(RowItem row)
Removes the given RowItem from the database. |
void |
removeRowIdChangeListener(QueryDelegate.RowIdChangeListener listener)
Removes the given RowIdChangeListener from this query |
void |
rollback()
Rolls back and releases the active connection. |
void |
setFilters(java.util.List<Container.Filter> filters)
Sets the filters to apply when performing the SQL query. |
void |
setOrderBy(java.util.List<OrderBy> orderBys)
Sets the order in which to retrieve rows from the database. |
void |
setVersionColumn(java.lang.String column)
|
int |
storeRow(RowItem row)
Stores a row in the database. |
RowId |
storeRowImmediately(RowItem row)
Inserts the given row in the database table immediately. |
Methods inherited from class com.vaadin.data.util.sqlcontainer.query.AbstractTransactionalQuery |
---|
ensureTransaction, getConnection, isInTransaction, releaseConnection |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TableQuery(java.lang.String tableName, JDBCConnectionPool connectionPool, SQLGenerator sqlGenerator)
TableQuery(String, String, String, JDBCConnectionPool, SQLGenerator)
.
tableName
- Name of the database table to connect toconnectionPool
- Connection pool for accessing the databasesqlGenerator
- SQL query generator implementationpublic TableQuery(java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName, JDBCConnectionPool connectionPool, SQLGenerator sqlGenerator)
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 implementationpublic TableQuery(java.lang.String tableName, JDBCConnectionPool connectionPool)
TableQuery(String, String, String, JDBCConnectionPool, SQLGenerator)
.
tableName
- Name of the database table to connect toconnectionPool
- Connection pool for accessing the databaseprotected TableQuery(java.lang.String catalogName, java.lang.String schemaName, java.lang.String tableName, JDBCConnectionPool connectionPool, SQLGenerator sqlGenerator, boolean escapeNames)
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-isMethod Detail |
---|
public int getCount() throws java.sql.SQLException
QueryDelegate
getCount
in interface QueryDelegate
java.sql.SQLException
public java.sql.ResultSet getResults(int offset, int pagelength) throws java.sql.SQLException
QueryDelegate
getResults
in interface QueryDelegate
offset
- the first item of the page to loadpagelength
- the length of the page to load
java.sql.SQLException
- if the database access fails.public boolean implementationRespectsPagingLimits()
QueryDelegate
implementationRespectsPagingLimits
in interface QueryDelegate
QueryDelegate.getResults(int, int)
public int storeRow(RowItem row) throws java.lang.UnsupportedOperationException, java.sql.SQLException
QueryDelegate
storeRow
in interface QueryDelegate
java.lang.UnsupportedOperationException
- if the implementation is read only.
java.sql.SQLException
public RowId storeRowImmediately(RowItem row) throws java.sql.SQLException
row
- RowItem to add to the database
java.sql.SQLException
public void setFilters(java.util.List<Container.Filter> filters) throws java.lang.UnsupportedOperationException
QueryDelegate
setFilters
in interface QueryDelegate
filters
- The filters to apply.
java.lang.UnsupportedOperationException
- if the implementation doesn't support filtering.public void setOrderBy(java.util.List<OrderBy> orderBys) throws java.lang.UnsupportedOperationException
QueryDelegate
setOrderBy
in interface QueryDelegate
orderBys
- A list of the OrderBy conditions.
java.lang.UnsupportedOperationException
- if the implementation doesn't support ordering.public void beginTransaction() throws java.lang.UnsupportedOperationException, java.sql.SQLException
AbstractTransactionalQuery
beginTransaction
in interface QueryDelegate
beginTransaction
in class AbstractTransactionalQuery
java.sql.SQLException
- if a connection could not be obtained or configured
java.lang.UnsupportedOperationException
public void commit() throws java.lang.UnsupportedOperationException, java.sql.SQLException
AbstractTransactionalQuery
commit
in interface QueryDelegate
commit
in class AbstractTransactionalQuery
java.sql.SQLException
- if not in a transaction managed by this query
java.lang.UnsupportedOperationException
public void rollback() throws java.lang.UnsupportedOperationException, java.sql.SQLException
AbstractTransactionalQuery
rollback
in interface QueryDelegate
rollback
in class AbstractTransactionalQuery
java.sql.SQLException
- if not in a transaction managed by this query
java.lang.UnsupportedOperationException
public java.util.List<java.lang.String> getPrimaryKeyColumns()
QueryDelegate
getPrimaryKeyColumns
in interface QueryDelegate
public java.lang.String getVersionColumn()
public void setVersionColumn(java.lang.String column)
public java.lang.String getTableName()
public java.lang.String getCatalogName()
public java.lang.String getSchemaName()
protected java.lang.String getFullTableName()
public SQLGenerator getSqlGenerator()
public boolean removeRow(RowItem row) throws java.lang.UnsupportedOperationException, java.sql.SQLException
QueryDelegate
removeRow
in interface QueryDelegate
row
- RowItem to be removed
java.lang.UnsupportedOperationException
java.sql.SQLException
public boolean containsRowWithKey(java.lang.Object... keys) throws java.sql.SQLException
QueryDelegate
containsRowWithKey
in interface QueryDelegate
keys
- the primary keys
java.sql.SQLException
public void addRowIdChangeListener(QueryDelegate.RowIdChangeListener listener)
addRowIdChangeListener
in interface QueryDelegate.RowIdChangeNotifier
listener
- listener to be added@Deprecated public void addListener(QueryDelegate.RowIdChangeListener listener)
addRowIdChangeListener(com.vaadin.data.util.sqlcontainer.query.QueryDelegate.RowIdChangeListener)
addListener
in interface QueryDelegate.RowIdChangeNotifier
public void removeRowIdChangeListener(QueryDelegate.RowIdChangeListener listener)
removeRowIdChangeListener
in interface QueryDelegate.RowIdChangeNotifier
listener
- listener to be removed@Deprecated public void removeListener(QueryDelegate.RowIdChangeListener listener)
removeRowIdChangeListener(com.vaadin.data.util.sqlcontainer.query.QueryDelegate.RowIdChangeListener)
removeListener
in interface QueryDelegate.RowIdChangeNotifier
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |