|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vaadin.data.util.sqlcontainer.query.TableQuery
public class TableQuery
Nested Class Summary | |
---|---|
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(String tableName,
JDBCConnectionPool connectionPool)
Creates a new TableQuery using the given connection pool and table name to fetch the data from. |
|
TableQuery(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. |
Method Summary | |
---|---|
void |
addListener(QueryDelegate.RowIdChangeListener listener)
Adds RowIdChangeListener to this query |
void |
beginTransaction()
Starts a new database transaction. |
void |
commit()
Commits a transaction. |
boolean |
containsRowWithKey(Object... keys)
Performs a query to find out whether the SQL table contains a row with the given set of primary keys. |
int |
getCount()
Generates and executes a query to determine the current row count from the DB. |
List<String> |
getPrimaryKeyColumns()
Returns a list of primary key column names. |
ResultSet |
getResults(int offset,
int pagelength)
Executes a paged SQL query and returns the ResultSet. |
SQLGenerator |
getSqlGenerator()
|
String |
getTableName()
|
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)
Removes the given RowIdChangeListener from this query |
boolean |
removeRow(RowItem row)
Removes the given RowItem from the database. |
void |
rollback()
Rolls a transaction back. |
void |
setFilters(List<Container.Filter> filters)
Sets the filters to apply when performing the SQL query. |
void |
setOrderBy(List<OrderBy> orderBys)
Sets the order in which to retrieve rows from the database. |
void |
setVersionColumn(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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TableQuery(String tableName, JDBCConnectionPool connectionPool, SQLGenerator sqlGenerator)
tableName
- Name of the database table to connect toconnectionPool
- Connection pool for accessing the databasesqlGenerator
- SQL query generator implementationpublic TableQuery(String tableName, JDBCConnectionPool connectionPool)
tableName
- Name of the database table to connect toconnectionPool
- Connection pool for accessing the databaseMethod Detail |
---|
public int getCount() throws SQLException
QueryDelegate
getCount
in interface QueryDelegate
SQLException
public ResultSet getResults(int offset, int pagelength) throws SQLException
QueryDelegate
getResults
in interface QueryDelegate
offset
- the first item of the page to loadpagelength
- the length of the page to load
SQLException
- if the database access fails.public boolean implementationRespectsPagingLimits()
QueryDelegate
implementationRespectsPagingLimits
in interface QueryDelegate
QueryDelegate.getResults(int, int)
public int storeRow(RowItem row) throws UnsupportedOperationException, SQLException
QueryDelegate
storeRow
in interface QueryDelegate
UnsupportedOperationException
- if the implementation is read only.
SQLException
public RowId storeRowImmediately(RowItem row) throws SQLException
row
- RowItem to add to the database
SQLException
public void setFilters(List<Container.Filter> filters) throws UnsupportedOperationException
QueryDelegate
setFilters
in interface QueryDelegate
filters
- The filters to apply.
UnsupportedOperationException
- if the implementation doesn't support filtering.public void setOrderBy(List<OrderBy> orderBys) throws UnsupportedOperationException
QueryDelegate
setOrderBy
in interface QueryDelegate
orderBys
- A list of the OrderBy conditions.
UnsupportedOperationException
- if the implementation doesn't support ordering.public void beginTransaction() throws UnsupportedOperationException, SQLException
QueryDelegate
beginTransaction
in interface QueryDelegate
SQLException
- if the database access fails.
UnsupportedOperationException
public void commit() throws UnsupportedOperationException, SQLException
QueryDelegate
commit
in interface QueryDelegate
SQLException
- if the database access fails.
UnsupportedOperationException
public void rollback() throws UnsupportedOperationException, SQLException
QueryDelegate
rollback
in interface QueryDelegate
SQLException
- if the database access fails.
UnsupportedOperationException
public List<String> getPrimaryKeyColumns()
QueryDelegate
getPrimaryKeyColumns
in interface QueryDelegate
public String getVersionColumn()
public void setVersionColumn(String column)
public String getTableName()
public SQLGenerator getSqlGenerator()
public boolean removeRow(RowItem row) throws UnsupportedOperationException, SQLException
QueryDelegate
removeRow
in interface QueryDelegate
row
- RowItem to be removed
UnsupportedOperationException
SQLException
public boolean containsRowWithKey(Object... keys) throws SQLException
QueryDelegate
containsRowWithKey
in interface QueryDelegate
keys
- the primary keys
SQLException
public void addListener(QueryDelegate.RowIdChangeListener listener)
addListener
in interface QueryDelegate.RowIdChangeNotifier
listener
- listener to be addedpublic void removeListener(QueryDelegate.RowIdChangeListener listener)
removeListener
in interface QueryDelegate.RowIdChangeNotifier
listener
- listener to be removed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |