|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.persism.Query
public final class Query
Performs read operations from the database.
Constructor Summary | |
---|---|
Query(java.sql.Connection connection)
|
Method Summary | ||
---|---|---|
|
read(java.lang.Class<T> objectClass,
java.lang.String sql,
java.lang.Object... parameters)
Reads an object of the specified type from the database. |
|
boolean |
read(java.lang.Object object)
Read an object from the database by it's primary key. |
|
|
readList(java.lang.Class<T> objectClass,
java.lang.String sql,
java.lang.Object... parameters)
Read a list of objects of the specified class using the specified SQL query and parameters. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Query(java.sql.Connection connection)
Method Detail |
---|
public <T> java.util.List<T> readList(java.lang.Class<T> objectClass, java.lang.String sql, java.lang.Object... parameters) throws PersismException
T
- objectClass
- class of objects to return.sql
- query string to execute.parameters
- parameters to the query.
PersismException
public boolean read(java.lang.Object object) throws PersismException
object
- Data object to read from the database.
PersismException
- if something goes wrong.public <T> T read(java.lang.Class<T> objectClass, java.lang.String sql, java.lang.Object... parameters) throws PersismException
T
- objectClass
- Type of returned valuesql
- query - this would usually be a select OR a select of a single column if the type is a primitive.
If this is a primitive type then this method will only look at the 1st column in the result.parameters
- parameters to the query.
PersismException
- if something funny?
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |