public class Query<I> extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
Query(Connection connection,
SqlDescriptor descriptor) |
|
Query(Connection connection,
String string,
Class<I> type)
Creates a new query object using the specified string and parameters.
|
|
Query(Connection connection,
String string,
Class<I> assignationType,
Class<I> instanciationType)
Creates a new query object using the specified string and parameters.
|
|
Query(String string,
Class<I> type)
Creates a new query object using the specified string and parameters.
|
|
Query(String string,
Class<I> assignationType,
Class<I> instanciationType)
Creates a new query object using the specified string and parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCreatedHandler(QueryEventHandler<I> handler)
Adds a post initialization handler.
|
void |
addCreatingHandler(QueryEventHandler<I> handler)
Adds a creating handler.
|
int |
count()
Counts the number of rows that will be returned by the current query.
|
List<I> |
execute()
Execute the query and returns the resulting object list.
|
void |
executeFill(Collection<? super I> col)
Executes the query and fills the specified list.
|
Class<I> |
getAssignationType()
Gets the type that will used to set values to the class instance during
operations.
|
Connection |
getConnection()
Gets the connection.
|
QueryEventHandlerSet<I> |
getCreatedHandler() |
QueryEventHandlerSet<I> |
getCreatingHandler() |
Filter |
getFilter()
Gets the filter.
|
Class<I> |
getInstanciationType()
Gets the type that will be created during fill operations.
|
List<Join> |
getJoins() |
String |
getOrderBy()
Gets the orderBy clause.
|
String |
getPrimaryKey()
Gets the primary key for the current query.
|
protected void |
onCreated(QueryEvent<I> action)
This method is called each time an object has been initialized with the
current row data.
|
protected <E extends I> |
onCreating(QueryEvent<E> action)
This method is called before the creation of a new object.
|
void |
removeCreatedHandler(QueryEventHandler<I> handler)
Removes a post initialization handler.
|
void |
removeCreatingHandler(QueryEventHandler<I> handler)
Removes a creating handler.
|
void |
setFilter(Filter filter)
Sets the filter.
|
void |
setOrderBy(String orderBy)
Sets the order by clause.
|
void |
setPrimaryKey(String value)
Sets the primary key for the current query.
|
String |
toString() |
protected Query(Connection connection, SqlDescriptor descriptor)
public Query(String string, Class<I> type)
string - The select query string.type - The class type to be used for operations.public Query(Connection connection, String string, Class<I> type)
connection - The connection to the database.string - The select query string.type - The class type to be used for operations.public Query(String string, Class<I> assignationType, Class<I> instanciationType)
string - The select query string.assignationType - The class type to be used for assignation operations.instanciationType - The class type to be used for instantiations operations.public Query(Connection connection, String string, Class<I> assignationType, Class<I> instanciationType)
connection - The connection to the database.string - The select query string.assignationType - The class type to be used for assignation operations.instanciationType - The class type to be used for instantiations operations.public void addCreatedHandler(QueryEventHandler<I> handler)
handler - the handler to add.public void removeCreatedHandler(QueryEventHandler<I> handler)
handler - the handler to remove.public QueryEventHandlerSet<I> getCreatedHandler()
public void addCreatingHandler(QueryEventHandler<I> handler)
handler - the handler to add.public void removeCreatingHandler(QueryEventHandler<I> handler)
handler - the handler to remove.public QueryEventHandlerSet<I> getCreatingHandler()
public String getPrimaryKey()
public void setPrimaryKey(String value)
value - the primary key property name.public Class<I> getAssignationType()
public Class<I> getInstanciationType()
public Connection getConnection()
public void setFilter(Filter filter)
filter - A filter object.public Filter getFilter()
public void setOrderBy(String orderBy)
orderBy - The orderBy clause.public String getOrderBy()
public int count()
throws SQLException
SQLException - if an error occurs during the SELECT COUNT operation.public List<I> execute() throws SQLException
SQLException - if an error occurs during the query execution.BrokenRuleExceptionpublic void executeFill(Collection<? super I> col) throws SQLException
col - the collection to be filled.SQLException - if an error occurs during the query execution.BrokenRuleExceptionprotected <E extends I> void onCreating(QueryEvent<E> action)
action - The action containing the event data.protected void onCreated(QueryEvent<I> action)
action - The action containing the event data.Copyright © 2013. All rights reserved.