|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IGenericDao
This interface represents a generic dao which is the preferred way of accesing Mr Persister.
Objects implementing this interface are capable of reading and writing objects to a database.
IGenericDao
instances should be obtained from the generic dao factory available
from the com.jenkov.mrpersister.MrPersister
class.
Example:
IGenericDao dao = MrPersister.getGenericDaoFactory().createDao(connection);
Method Summary | |
---|---|
void |
closeConnection()
Closes the connection used by this GenericDao instance. |
void |
commit()
Call commit() on the underlying connection. |
int |
delete(java.lang.Object object)
Same as delete(Object objectMappingKey, Object object) but uses
the object.getClass() as the object mapping key. |
int |
delete(java.lang.Object objectMappingKey,
java.lang.Object object)
Deletes the record from the database coresponding to the given object, according to the object mapping stored or generated by the given object mapping key. |
int[] |
deleteBatch(java.util.Collection objects)
Same as deleteBatch(Object objectMappingKey, Collection objects)
but uses the class returned by the getClass() method of the first object
in the collection, as returned by the collection iterator, as the
object mapping key. |
int[] |
deleteBatch(java.lang.Object objectMappingKey,
java.util.Collection objects)
Deletes the records from the database coresponding to the given objects, according to the object mapping stored or generated by the given object mapping key. |
int[] |
deleteBatchByPrimaryKeys(java.lang.Object objectMappingKey,
java.util.Collection primaryKeys)
Deletes the records from the database coresponding to the given primary keys, according to the object mapping stored or generated by the given object mapping key. |
int |
deleteByPrimaryKey(java.lang.Object objectMappingKey,
java.lang.Object primaryKey)
Deletes the record from the database matching the given primary key, according to the object mapping stored or generated by the given object mapping key. |
int |
executeUpdate(java.lang.String sql)
Executes the given SQL update. |
int |
executeUpdate(java.lang.String sql,
java.util.Collection parameters)
Executes the given SQL update. |
int |
executeUpdate(java.lang.String sql,
java.lang.Object[] parameters)
Executes the given SQL update. |
IPersistenceConfiguration |
getConfiguration()
Returns the configuration used by this IGenericDao instance. |
java.sql.Connection |
getConnection()
Returns the connection used by this GenericDao instance. |
UpdateResult |
getUpdateResult(int index)
Returns an UpdateResult instance. |
java.util.List |
getUpdateResults()
Returns a List of UpdateResult instances. |
int |
insert(java.lang.Object object)
Same as insert(Object objectMappingKey, Object object) , but
uses object.getClass() as the object mapping key. |
int |
insert(java.lang.Object objectMappingKey,
java.lang.Object object)
Inserts a record in the database with the values from the given object according to the object mapping stored or generated by the given object mapping key. |
int[] |
insertBatch(java.util.Collection objects)
Same as insertBatch(Object objectMappingKey, Collection objects) but uses
the class returned by the getClass() of the first element in the collection
as the object mapping key. |
int[] |
insertBatch(java.lang.Object objectMappingKey,
java.util.Collection objects)
Inserts several records into the database with the values from the given objects according to the object mapping stored or generated by the given object mapping key. |
java.lang.Object |
read(java.lang.Object objectMappingKey,
java.sql.PreparedStatement statement)
Reads a single object from the database using the given PreparedStatement
instance, and the object mapping stored by the given object mapping key. |
java.lang.Object |
read(java.lang.Object objectMappingKey,
java.sql.ResultSet result)
Reads a single object from the given ResultSet using the object mapping
stored by the given object mapping key. |
java.lang.Object |
read(java.lang.Object objectMappingKey,
java.sql.Statement statement,
java.lang.String sql)
Reads a single object from the database using the given Statement
instance, the given SQL string, and the object mapping
stored by the given object mapping key. |
java.lang.Object |
read(java.lang.Object objectMappingKey,
java.lang.String sql)
Reads a single object from the database using the object mapping stored by the given object mapping key, and the given SQL string. |
java.lang.Object |
read(java.lang.Object objectMappingKey,
java.lang.String sql,
java.util.Collection parameters)
Reads a single object from the database using the given SQL string, the parameters, and the object mapping stored by the given object mapping key. |
java.lang.Object |
read(java.lang.Object objectMappingKey,
java.lang.String sql,
java.lang.Object[] parameters)
Reads a single object from the database using the given SQL string, the parameters, and the object mapping stored by the given object mapping key. |
java.lang.Object |
readByPrimaryKey(java.lang.Object objectMappingKey,
java.lang.Object primaryKey)
Reads a single object from the database using the object mapping stored by the given object mapping key, and the given primary key to identify the record in the database that coresponds to the object to be read. |
java.util.List |
readList(java.lang.Object objectMappingKey,
java.sql.PreparedStatement statement)
Reads a list of objects using the object mapping stored or generated by the given object mapping key and PreparedStatement instance. |
java.util.List |
readList(java.lang.Object objectMappingKey,
java.sql.PreparedStatement statement,
IReadFilter filter)
Reads a list of objects using the object mapping stored or generated by the given object mapping key and PreparedStatement instance. |
java.util.List |
readList(java.lang.Object objectMappingKey,
java.sql.ResultSet result)
Reads a list of objects from the given ResultSet using the object mapping
stored or generated by the given object mapping key. |
java.util.List |
readList(java.lang.Object objectMappingKey,
java.sql.ResultSet result,
IReadFilter filter)
Reads a list of objects from the given ResultSet using the object mapping
stored or generated by the given object mapping key. |
java.util.List |
readList(java.lang.Object objectMappingKey,
java.sql.Statement statement,
java.lang.String sql)
Reads a list of objects from the database using the given Statement
instance, the given SQL string and the object mapping
stored or generated by the given object mapping key. |
java.util.List |
readList(java.lang.Object objectMappingKey,
java.sql.Statement statement,
java.lang.String sql,
IReadFilter filter)
Reads a list of objects from the database using the given Statement
instance, the given SQL string and the object mapping
stored or generated by the given object mapping key. |
java.util.List |
readList(java.lang.Object objectMappingKey,
java.lang.String sql)
Reads a list of objects from the database using the object mapping stored or generated by the given object mapping key, and the given SQL string. |
java.util.List |
readList(java.lang.Object objectMappingKey,
java.lang.String sql,
java.util.Collection parameters)
Reads a list of objects using the object mapping stored or generated by the given object mapping key, and a PreparedStatement instance created from the
sql parameter, and the parameter collection. |
java.util.List |
readList(java.lang.Object objectMappingKey,
java.lang.String sql,
java.util.Collection parameters,
IReadFilter filter)
Reads a list of objects using the object mapping stored or generated by the given object mapping key, and a PreparedStatement instance created from the
sql parameter, and the parameter array. |
java.util.List |
readList(java.lang.Object objectMappingKey,
java.lang.String sql,
IReadFilter filter)
Reads a list of objects from the database using the object mapping stored or generated by the given object mapping key, and the given SQL string. |
java.util.List |
readList(java.lang.Object objectMappingKey,
java.lang.String sql,
java.lang.Object[] parameters)
Reads a list of objects using the object mapping stored or generated by the given object mapping key, and a PreparedStatement instance created from the
sql parameter, and the parameter array. |
java.util.List |
readList(java.lang.Object objectMappingKey,
java.lang.String sql,
java.lang.Object[] parameters,
IReadFilter filter)
Reads a list of objects using the object mapping stored or generated by the given object mapping key, and a PreparedStatement instance created from the
sql parameter, and the parameter array. |
java.util.List |
readListByPrimaryKeys(java.lang.Object objectMappingKey,
java.util.Collection primaryKeys)
Reads a list of objects from the database using the object mapping stored by the given object mapping key, and the given primary keys to identify the records in the database that coresponds to the objects to be read. |
void |
rollback()
Calls rollback() on the underlying connection. |
void |
setAutoCommit(boolean autoCommit)
Calls setAutoCommit on the underlying connection. |
int |
update(java.lang.Object object)
Same as update(Object objectMappingKey, Object object)
but uses the object.getClass() as the object mapping key. |
int |
update(java.lang.Object objectMappingKey,
java.lang.Object object)
Updates the record in the database coresponding to the given object, with the values contained in this object, according to the object mapping stored or generated by the given object mapping key. |
int[] |
updateBatch(java.util.Collection objects)
Same as updateBatch(Object objectMappingKey, Collection objects)
the class returned by the getClass() of the first element in the collection
as the object mapping key. |
int[] |
updateBatch(java.lang.Object objectMappingKey,
java.util.Collection objects)
Updates the records in the database coresponding to the given collection of objects, with the values contained in these objects, according to the object mapping stored or generated by the given object mapping key. |
int[] |
updateBatchByPrimaryKeys(java.util.Collection objects,
java.util.Collection oldPrimaryKeys)
Same as updateBatchByPrimaryKeys(Object objectMappingKey, Collection objects, Collection oldPrimaryKeys)
the class returned by the getClass() of the first element in the collection
as the object mapping key. |
int[] |
updateBatchByPrimaryKeys(java.lang.Object objectMappingKey,
java.util.Collection objects,
java.util.Collection oldPrimaryKeys)
Updates the records in the database coresponding to the given collection of objects, with the values contained in these objects, according to the object mapping stored or generated by the given object mapping key. |
int |
updateByPrimaryKey(java.lang.Object object,
java.lang.Object oldPrimaryKeyValue)
Same as updateByPrimaryKey(Object objectMappingKey, Object object, Object oldPrimaryKeyValue)
but uses the object.getClass() as the object mapping key. |
int |
updateByPrimaryKey(java.lang.Object objectMappingKey,
java.lang.Object object,
java.lang.Object oldPrimaryKeyValue)
Updates the record in the database coresponding to the given object, with the values contained in this object, according to the object mapping stored or generated by the given object mapping key. |
int |
updateOptimistic(java.lang.Object object,
java.lang.Object original)
Same as updateOptimistic(Object objectMappingKey, Object object, Object original)
but uses the object.getClass() as the object mapping key. |
int |
updateOptimistic(java.lang.Object objectMappingKey,
java.lang.Object object,
java.lang.Object original)
Updates the record in the database coresponding to the given object, with the values contained in this object, according to the object mapping stored or generated by the given object mapping key. |
Method Detail |
---|
IPersistenceConfiguration getConfiguration()
IGenericDao
instance. You can use this
configuration to access cached object mappings, set a custom object mapper, exchange automatic
object mapper etc. Just remember: The configuration instance is shared by many IGenericDao instances.
Make sure you do not make changes to the configuration that invalidates what other dao instances
is doing. Preferrably you make the changes once in the beginning of your application.
IGenericDao
instance.java.sql.Connection getConnection()
void closeConnection() throws PersistenceException
PersistenceException
- If closing the connection fails.void setAutoCommit(boolean autoCommit) throws PersistenceException
autoCommit
- True if you want auto-commit on. False if not. Use false for transactions that involves
several reads / writes to the database.
PersistenceException
- If an SQLException is thrown by the underlying connection.void commit() throws PersistenceException
PersistenceException
void rollback() throws PersistenceException
PersistenceException
java.util.List getUpdateResults()
UpdateResult getUpdateResult(int index)
index
- The index of the update method invocation you want the update result for.
java.lang.Object readByPrimaryKey(java.lang.Object objectMappingKey, java.lang.Object primaryKey) throws PersistenceException
com.jenkov.mrpersister.impl.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the object to be read,
meaning if you want to read an object of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.primaryKey
- The primary key value identifying the record to be read into an object.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.lang.Object read(java.lang.Object objectMappingKey, java.lang.String sql) throws PersistenceException
ResultSet
generated by it, only the first record in the
ResultSet
will be read into an object and returned.
com.jenkov.mrpersister.impl.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the object to be read,
meaning if you want to read an object of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.sql
- The SQL string locating the record to be read into an object.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.lang.Object read(java.lang.Object objectMappingKey, java.sql.ResultSet result) throws PersistenceException
ResultSet
using the object mapping
stored by the given object mapping key. If the ResultSet
contains
more than one record, only the first record in the
ResultSet
will be read into an object and returned.
ResultSet
. You must remember to close the ResultSet
yourself when you are done with it.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the object to be read,
meaning if you want to read an object of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.result
- The ResultSet
to read the object from.
ResultSet
using the object mapping
stored by the given object mapping key.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.lang.Object read(java.lang.Object objectMappingKey, java.sql.Statement statement, java.lang.String sql) throws PersistenceException
Statement
instance, the given SQL string, and the object mapping
stored by the given object mapping key. If the ResultSet
generated
by the Statement
instance when executing the SQL string contains
more than one record, only the first record in the
ResultSet
will be read into an object and returned.
Statement
instance.
If you don't need a special/customized Statement
instance,
the other read
methods will be easier to use.
Statement
instance. You must remember to close the
Statement
yourself when you are done with it.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the object to be read,
meaning if you want to read an object of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.statement
- The Statement
instance to use to execute the SQL string.sql
- The SQL string to be executed by the Statement
instance.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.lang.Object read(java.lang.Object objectMappingKey, java.sql.PreparedStatement statement) throws PersistenceException
PreparedStatement
instance, and the object mapping stored by the given object mapping key.
The PreparedStatement
instance must have all parameters set before calling
this method (using the PreparedStatement.setXXX(index, value) methods).
If the ResultSet
generated
by the PreparedStatement
instance contains
more than one record, only the first record in the
ResultSet
will be read into an object and returned.
PreparedStatement
passed as parameter. You must remember to
close the PreparedStatement
yourself when you are done with it.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the object to be read,
meaning if you want to read an object of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.statement
- The PreparedStatement
instance locating the object to read.
ResultSet
generated by the
given PreparedStatement
, according to the object mapping
located or generated by the given object mapping key.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.lang.Object read(java.lang.Object objectMappingKey, java.lang.String sql, java.util.Collection parameters) throws PersistenceException
PreparedStatement
instance will be created using the
given SQL string, and the parameters collection will be inserted into it.
Therefore the SQL string should have the same format as those used with a
PreparedStatement
. The parameters will be inserted in the
sequence returned by the parameter collection's iterator.
ResultSet
generated
by the PreparedStatement
instance contains
more than one record, only the first record in the
ResultSet
will be read into an object and returned.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the object to be read,
meaning if you want to read an object of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.
ResultSet
generated by the
given PreparedStatement
, according to the object mapping
located or generated by the given object mapping key.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.lang.Object read(java.lang.Object objectMappingKey, java.lang.String sql, java.lang.Object[] parameters) throws PersistenceException
PreparedStatement
instance will be created using the
given SQL string, and the parameters collection will be inserted into it.
Therefore the SQL string should have the same format as those used with a
PreparedStatement
. The parameters will be inserted in the
sequence returned by the parameter collection's iterator.
ResultSet
generated
by the PreparedStatement
instance contains
more than one record, only the first record in the
ResultSet
will be read into an object and returned.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the object to be read,
meaning if you want to read an object of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.
ResultSet
generated by the
given PreparedStatement
, according to the object mapping
located or generated by the given object mapping key.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.util.List readListByPrimaryKeys(java.lang.Object objectMappingKey, java.util.Collection primaryKeys) throws PersistenceException
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the objects to be read,
meaning if you want to read objects of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.primaryKeys
- The primary key values identifying the records to be read into objects.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.util.List readList(java.lang.Object objectMappingKey, java.lang.String sql) throws PersistenceException
ResultSet
generated by the SQL string.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the objects to be read,
meaning if you want to read objects of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.sql
- The String string locating the records to be read into objects.
List
of objects read from the database.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.util.List readList(java.lang.Object objectMappingKey, java.sql.ResultSet result) throws PersistenceException
ResultSet
using the object mapping
stored or generated by the given object mapping key. The objects will appear in the
list in the same order their coresponding records appear in the
ResultSet
.
ResultSet
. You must remember to close the ResultSet
yourself when you are done with it.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the objects to be read,
meaning if you want to read objects of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.result
- The ResultSet
to read the list of objects from.
List
of objects read from the database.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.util.List readList(java.lang.Object objectMappingKey, java.sql.Statement statement, java.lang.String sql) throws PersistenceException
Statement
instance, the given SQL string and the object mapping
stored or generated by the given object mapping key. The objects will appear in the
list in the same order their coresponding records appear in the
ResultSet
generated by the Statement
's execution of the
SQL string.
Statement
instance.
If you don't need a special/customized Statement
instance,
the other read
methods will be easier to use.
No database connections will be opened. The objects will be read from the provided
Statement
. You must remember
to close the Statement
after your are dont with it.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
The Class
instance should be the class of the object to be stored,
meaning if you want to store an object of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.statement
- The Statement
instance to be used to execute the SQL string.sql
- The SQL string to be executed by the Statement
instance.
List
of objects read from the database.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.util.List readList(java.lang.Object objectMappingKey, java.sql.PreparedStatement statement) throws PersistenceException
PreparedStatement
instance.
The PreparedStatement
instance must have all parameters set before calling
this method (using the PreparedStatement.setXXX(index, value) methods).
The objects will appear in the
list in the same order their coresponding records appear in the
ResultSet
generated by the PreparedStatement
instance.
PreparedStatement
passed as parameter. You must remember to
close the PreparedStatement
yourself when you are done with it.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
The Class
instance should be the class of the objects to be read,
meaning if you want to read objects of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.statement
- The PreparedStatement
instance locating the list of objects to read.
List
of objects read from the database.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.util.List readList(java.lang.Object objectMappingKey, java.lang.String sql, java.util.Collection parameters) throws PersistenceException
PreparedStatement
instance created from the
sql parameter, and the parameter collection. A PreparedStatement
instance
will be generated using the connection obtained by calling getConnection(),
and calling it's prepareStatement(sql), where sql is the sql parameter passed in
here as parameter. Hence the sql parameter must match the format used with
prepared statements (? - mark for parameters)
ResultSet
generated by the PreparedStatement
instance.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
The Class
instance should be the class of the objects to be read,
meaning if you want to read objects of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.sql
- The SQL string to use to prepare a PreparedStatement
.parameters
- The parameters to insert into the PreparedStatement
.
List
of objects read from the database.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.util.List readList(java.lang.Object objectMappingKey, java.lang.String sql, java.lang.Object[] parameters) throws PersistenceException
PreparedStatement
instance created from the
sql parameter, and the parameter array. A PreparedStatement
instance
will be generated using the connection obtained by calling getConnection(),
and calling it's prepareStatement(sql), where sql is the sql parameter passed in
here as parameter. Hence the sql parameter must match the format used with
prepared statements (? - mark for parameters)
ResultSet
generated by the PreparedStatement
instance.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
The Class
instance should be the class of the objects to be read,
meaning if you want to read objects of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.sql
- The SQL string to use to prepare a PreparedStatement
.parameters
- The parameters to insert into the PreparedStatement
.
List
of objects read from the database.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.util.List readList(java.lang.Object objectMappingKey, java.lang.String sql, IReadFilter filter) throws PersistenceException
ResultSet
generated by the SQL string.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the objects to be read,
meaning if you want to read objects of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.sql
- The SQL string locating the records to read into objects.filter
- A filter that can include or exclude individual records.
List
of objects read from the database.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.util.List readList(java.lang.Object objectMappingKey, java.sql.ResultSet result, IReadFilter filter) throws PersistenceException
ResultSet
using the object mapping
stored or generated by the given object mapping key. The objects will appear in the
list in the same order their coresponding records appear in the
ResultSet
.
ResultSet
will be included in the returned list.
ResultSet
. You must remember to close the ResultSet
yourself when you are done with it.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the objects to be read,
meaning if you want to read objects of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.result
- The ResultSet
to read the list of objects from.filter
- A filter that can include or exclude individual records.
List
of objects read from the database.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.util.List readList(java.lang.Object objectMappingKey, java.sql.Statement statement, java.lang.String sql, IReadFilter filter) throws PersistenceException
Statement
instance, the given SQL string and the object mapping
stored or generated by the given object mapping key. The objects will appear in the
list in the same order their coresponding records appear in the
ResultSet
generated by the Statement
's execution of the
SQL string.
ResultSet
will be included in the returned list.
Statement
instance.
If you don't need a special/customized Statement
instance,
the other read
methods will be easier to use.
Statement
. You must remember to close the Statement
yourself when you are done with it.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the objects to be read,
meaning if you want to read objects of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.statement
- The Statement
instance to be used to execute the SQL string.sql
- The SQL string to be executed by the Statement
instance.filter
- A filter that can include or exclude individual records.
List
of objects read from the database.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.util.List readList(java.lang.Object objectMappingKey, java.sql.PreparedStatement statement, IReadFilter filter) throws PersistenceException
PreparedStatement
instance.
The PreparedStatement
instance must have all parameters set before calling
this method (using the PreparedStatement.setXXX(index, value) methods).
The objects will appear in the
list in the same order their coresponding records appear in the
ResultSet
generated by the PreparedStatement
instance.
ResultSet
will be included in the returned list.
PreparedStatement
. You must remember to close the PreparedStatement
yourself when you are done with it.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the object to be ,
meaning if you want to store an object of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.statement
- The PreparedStatement
instance locating the list of objects to read.filter
- A filter that can include or exclude individual records.
List
of objects read from the database.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.util.List readList(java.lang.Object objectMappingKey, java.lang.String sql, java.util.Collection parameters, IReadFilter filter) throws PersistenceException
PreparedStatement
instance created from the
sql parameter, and the parameter array. A PreparedStatement
instance
will be generated using the connection obtained by calling getConnection(),
and calling it's prepareStatement(sql), where sql is the sql parameter passed in
here as parameter. Hence the sql parameter must match the format used with
prepared statements (? - mark for parameters)
ResultSet
generated by the PreparedStatement
instance.
ResultSet
will be included in the returned list.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
The Class
instance should be the class of the objects to be read,
meaning if you want to read objects of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.sql
- The SQL string to use to prepare a PreparedStatement
.parameters
- The parameters to insert into the PreparedStatement
.filter
- A filter that can include or exclude individual records.
List
of objects read from the database.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.java.util.List readList(java.lang.Object objectMappingKey, java.lang.String sql, java.lang.Object[] parameters, IReadFilter filter) throws PersistenceException
PreparedStatement
instance created from the
sql parameter, and the parameter array. A PreparedStatement
instance
will be generated using the connection obtained by calling getConnection(),
and calling it's prepareStatement(sql), where sql is the sql parameter passed in
here as parameter. Hence the sql parameter must match the format used with
prepared statements (? - mark for parameters)
ResultSet
generated by the PreparedStatement
instance.
ResultSet
will be included in the returned list.
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
The Class
instance should be the class of the objects to be read,
meaning if you want to read objects of class Employee
the
Class
instance should be that found at Employee.class
.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.sql
- The SQL string to use to prepare a PreparedStatement
.parameters
- The parameters to insert into the PreparedStatement
.filter
- A filter that can include or exclude individual records.
List
of objects read from the database.
PersistenceException
- If anything goes wrong during the read, if no persistence
configuration is set, if the persistence configuration contains
no object reader, or if no object mapping could be found nor generated
from the given object mapping key.int insert(java.lang.Object object) throws PersistenceException
insert(Object objectMappingKey, Object object)
, but
uses object.getClass() as the object mapping key.
object
- The object containing the values to be inserted into the new record.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the insert, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int insert(java.lang.Object objectMappingKey, java.lang.Object object) throws PersistenceException
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the object to be inserted,
meaning if you want to insert an object of class Employee
the
Class
instance should be that found at Employee.class
.
PreparedStatement
.
The SQL string contains "?" characters for the values will be cached for later
use to avoid the SQL generation overhead.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.object
- The object containing the values to be inserted into the new record.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the insert, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int[] insertBatch(java.util.Collection objects) throws PersistenceException
insertBatch(Object objectMappingKey, Collection objects)
but uses
the class returned by the getClass() of the first element in the collection
as the object mapping key.
The first element is extracted using a standard Iterator.
objects
- The object containing the values to be inserted into the new record.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the insert, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int[] insertBatch(java.lang.Object objectMappingKey, java.util.Collection objects) throws PersistenceException
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the objects to be inserted,
meaning if you want to insert objects of class Employee
the
Class
instance should be that found at Employee.class
.
PreparedStatement
.
The SQL string contains "?" characters for the values will be cached for later
use to avoid the SQL generation overhead.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.objects
- The object containing the values to be inserted into the new record.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the insert, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int update(java.lang.Object object) throws PersistenceException
update(Object objectMappingKey, Object object)
but uses the object.getClass() as the object mapping key.
object
- The object containing the values to be update in the coresponding record.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the update, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int update(java.lang.Object objectMappingKey, java.lang.Object object) throws PersistenceException
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the object to be updated,
meaning if you want to update an object of class Employee
the
Class
instance should be that found at Employee.class
.
PreparedStatement
.
The SQL string contains "?" characters for the values will be cached for later
use to avoid the SQL generation overhead.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.object
- The object containing the values to be update in the coresponding record.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the update, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int updateOptimistic(java.lang.Object object, java.lang.Object original) throws PersistenceException
updateOptimistic(Object objectMappingKey, Object object, Object original)
but uses the object.getClass() as the object mapping key.
object
- The object containing the values to be update in the coresponding record.original
- The original object containing the values to to identify the row.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the update, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int updateOptimistic(java.lang.Object objectMappingKey, java.lang.Object object, java.lang.Object original) throws PersistenceException
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the object to be updated,
meaning if you want to update an object of class Employee
the
Class
instance should be that found at Employee.class
.
PreparedStatement
.
The SQL string contains "?" characters for the values will be cached for later
use to avoid the SQL generation overhead.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.object
- The object containing the values to be update in the coresponding record.original
- The original object containing the values to to identify the row.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the update, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int updateByPrimaryKey(java.lang.Object object, java.lang.Object oldPrimaryKeyValue) throws PersistenceException
updateByPrimaryKey(Object objectMappingKey, Object object, Object oldPrimaryKeyValue)
but uses the object.getClass() as the object mapping key.
object
- The object containing the values to be update in the coresponding record.oldPrimaryKeyValue
- The primary key value of the record to update, meaning the value of the
primary key before it was changed in the object to update.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the update, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int updateByPrimaryKey(java.lang.Object objectMappingKey, java.lang.Object object, java.lang.Object oldPrimaryKeyValue) throws PersistenceException
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the object to be updated,
meaning if you want to update an object of class Employee
the
Class
instance should be that found at Employee.class
.
PreparedStatement
.
The SQL string contains "?" characters for the values will be cached for later
use to avoid the SQL generation overhead.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.object
- The object containing the values to be update in the coresponding record.oldPrimaryKeyValue
- The primary key value of the record to update, meaning the value of the
primary key before it was changed in the object to update.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the update, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int[] updateBatch(java.util.Collection objects) throws PersistenceException
updateBatch(Object objectMappingKey, Collection objects)
the class returned by the getClass() of the first element in the collection
as the object mapping key.
objects
- The collection of objects containing the values for the records to be updated.
PreparedStatement.executeBatch()
.
PersistenceException
- If anything goes wrong during the update, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int[] updateBatch(java.lang.Object objectMappingKey, java.util.Collection objects) throws PersistenceException
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the objects to be updated,
meaning if you want to update objects of class Employee
the
Class
instance should be that found at Employee.class
.
PreparedStatement
.
The SQL string contains "?" characters for the values will be cached for later
use to avoid the SQL generation overhead.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.objects
- The collection of objects containing the values for the records to be updated.
PreparedStatement.executeBatch()
.
PersistenceException
- If anything goes wrong during the update, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int[] updateBatchByPrimaryKeys(java.util.Collection objects, java.util.Collection oldPrimaryKeys) throws PersistenceException
updateBatchByPrimaryKeys(Object objectMappingKey, Collection objects, Collection oldPrimaryKeys)
the class returned by the getClass() of the first element in the collection
as the object mapping key.
objects
- The collection of objects containing the values for the records to be updated.oldPrimaryKeys
- The collection of old primary keys each matching an object in the objects collection.
The keys must be returned by the collection iterator in the same sequence
as the objects they match are returned by the object.iterator().
PreparedStatement.executeBatch()
.
PersistenceException
- If anything goes wrong during the update, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int[] updateBatchByPrimaryKeys(java.lang.Object objectMappingKey, java.util.Collection objects, java.util.Collection oldPrimaryKeys) throws PersistenceException
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the objects to be updated,
meaning if you want to update objects of class Employee
the
Class
instance should be that found at Employee.class
.
PreparedStatement
.
The SQL string contains "?" characters for the values will be cached for later
use to avoid the SQL generation overhead.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.objects
- The collection of objects containing the values for the records to be updated.oldPrimaryKeys
- The collection of old primary keys each matching an object in the objects collection.
The keys must be returned by the collection iterator in the same sequence
as the objects they match are returned by the object.iterator().
PreparedStatement.executeBatch()
.
PersistenceException
- If anything goes wrong during the update, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int delete(java.lang.Object object) throws PersistenceException
delete(Object objectMappingKey, Object object)
but uses
the object.getClass() as the object mapping key.
object
- The object containing the primary key of the record to be deleted.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the delete, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int delete(java.lang.Object objectMappingKey, java.lang.Object object) throws PersistenceException
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the object to be deleted,
meaning if you want to delete an object of class Employee
the
Class
instance should be that found at Employee.class
.
PreparedStatement
.
The SQL string contains one or more "?" characters for the primary key value and will thus be cached for later
use to avoid the SQL generation overhead.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.object
- The object containing the primary key of the record to be deleted.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the delete, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int[] deleteBatch(java.util.Collection objects) throws PersistenceException
deleteBatch(Object objectMappingKey, Collection objects)
but uses the class returned by the getClass() method of the first object
in the collection, as returned by the collection iterator, as the
object mapping key.
objects
- The collection containing the objects to be deleted.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the delete, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int[] deleteBatch(java.lang.Object objectMappingKey, java.util.Collection objects) throws PersistenceException
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the objects to be deleted,
meaning if you want to delete objects of class Employee
the
Class
instance should be that found at Employee.class
.
PreparedStatement
.
The SQL string contains one or more "?" characters for the primary key value and will thus be cached for later
use to avoid the SQL generation overhead.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.objects
- The collection containing the objects to be deleted.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the delete, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int deleteByPrimaryKey(java.lang.Object objectMappingKey, java.lang.Object primaryKey) throws PersistenceException
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the object to be deleted,
meaning if you want to delete an object of class Employee
the
Class
instance should be that found at Employee.class
.
PreparedStatement
.
The SQL string contains one or more "?" characters for the primary key value and will thus be cached for later
use to avoid the SQL generation overhead.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.primaryKey
- The primary key matching the record to be deleted.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the delete, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int[] deleteBatchByPrimaryKeys(java.lang.Object objectMappingKey, java.util.Collection primaryKeys) throws PersistenceException
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectMappingKey's setObjectClass(Class theClass) method).
Class
instance should be the class of the objects to be deleted,
meaning if you want to delete objects of class Employee
the
Class
instance should be that found at Employee.class
.
PreparedStatement
.
The SQL string contains one or more "?" characters for the primary key value and will thus be cached for later
use to avoid the SQL generation overhead.
objectMappingKey
- The object mapping key by which the object mapping to be used is stored
in the object mapping cache, in the persistence configuration used by this
instance of the DAO class.primaryKeys
- The collection containing the primary keys of the records to be deleted.
PreparedStatement.executeUpdate()
.
PersistenceException
- If anything goes wrong during the delete, if no persistence
configuration is set, if the persistence configuration contains
no object writer, or if no object mapping could be found nor generated
from the given object mapping key.int executeUpdate(java.lang.String sql) throws PersistenceException
Statement
using the
Connection
stored inside this GenericDao instance, then executes
the SQL update using that Statement
instance.
sql
- The SQL udpate to execute.
Statement.executeUpdate(sql)
.
PersistenceException
- If a Statement cannot be created, or
an error occurs when attempting to execute the update.int executeUpdate(java.lang.String sql, java.util.Collection parameters) throws PersistenceException
PreparedStatement
using the
Connection
stored inside this GenericDao instance, then executes
the SQL update using that PreparedStatement
instance. The parameters
are inserted into the PreparedStatement
instance in the sequence
they occur in the Iterator
returned by the parameter collection.
In most cases it is easiest to use a list as the collection.
sql
- The SQL udpate to execute.parameters
- The parameters to be inserted into the PreparedStatement
PreparedStatement.executeUpdate(sql)
.
PersistenceException
- If a PreparedStatement
cannot be created, or
an error occurs when attempting to execute the update.int executeUpdate(java.lang.String sql, java.lang.Object[] parameters) throws PersistenceException
PreparedStatement
using the
Connection
stored inside this GenericDao instance, then executes
the SQL update using that PreparedStatement
instance. The parameters
are inserted into the PreparedStatement
instance in the sequence
they occur in the parameter array.
sql
- The SQL udpate to execute.parameters
- The parameters to be inserted into the PreparedStatement
PreparedStatement.executeUpdate(sql)
.
PersistenceException
- If a PreparedStatement
cannot be created, or
an error occurs when attempting to execute the update.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |