|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jenkov.mrpersister.impl.AbstractDao
public abstract class AbstractDao
The AbstractDao
class is the users main interface to the Mr. Persister API.
The AbstractDao
class glues most of the Mr. Persister components together
behind the back of the user.
To use the AbstractDao
class you must create a class that extends it. This
subclass then has a lot of methods available that makes creating that DAO class a lot
easier.
The AbstractDao
uses a IPersistenceConfiguration
instance
internally to group together the component instances to be used with each other.
By default the persistence configuration will be set to the instance returned by
com.jenkov.mrpersister.MrPersister.getConfigurationOrFail(this.getClass())
.
That means that each AbstractDao subclass uses it's own persistence configuration.
You may never have
to change the persistence configuration, though it may become a point of
congestion if you have many threads accessing the same persistence configuration
instance. This is because the various caches are synchronized to make sure
that items stored in them by one thread are visible to other threads. The more
DAO classes use the same persistence configuration, the more often threads will
be waiting for each other at the caches.
To use a different persistence configuration
instance with a subclass of AbstractDao simply set it in the constructor of
the subclass by calling the setConfiguration() method inherited from AbstractDao.
Use the
com.jenkov.mrpersister.MrPersister.getConfigurationOrFail(Object key)
to
get a fresh persistence configuration instance. If none is found by the given
key one is instantiated.
Field Summary | |
---|---|
protected IPersistenceConfiguration |
configuration
|
Constructor Summary | |
---|---|
AbstractDao()
|
Method Summary | |
---|---|
protected void |
close(java.sql.Connection connection)
Closes the given Connection |
protected void |
close(java.sql.PreparedStatement statement)
Closes the given PreparedStatement |
protected void |
close(java.sql.ResultSet result)
Closes the given ResultSet |
protected void |
close(java.sql.Statement statement)
Closes the given Statement |
protected IObjectMapping |
createManualObjectMapping(java.lang.Object objectMappingKey)
Override this method to provide a manually created object mapping for an object mapping key (a class to be mapped). |
protected IObjectMapping |
createObjectMapping(java.lang.Class theClass)
Creates an object mapping that maps the class to a table and fields in the database by guessing the table and column names. |
protected IObjectMapping |
createObjectMapping(java.lang.Class theClass,
java.lang.String tableName)
Creates an object mapping that maps the class to the table with the table name given in the tableName parameter. |
protected int |
delete(java.lang.Object object)
Same as delete(Object objectMappingKey, Object object) but uses
the object.getClass() as the object mapping key. |
protected int |
delete(java.lang.Object object,
java.sql.Connection connection)
Same as delete(Object objectMappingKey, Object object, Connection connection) but uses
the object.getClass() as the object mapping key. |
protected 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. |
protected int |
delete(java.lang.Object objectMappingKey,
java.lang.Object object,
java.sql.Connection connection)
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. |
protected 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. |
protected int[] |
deleteBatch(java.util.Collection objects,
java.sql.Connection connection)
Same as deleteBatch(Object objectMappingKey, Collection objects, Connection connection)
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. |
protected 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. |
protected int[] |
deleteBatch(java.lang.Object objectMappingKey,
java.util.Collection objects,
java.sql.Connection connection)
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. |
protected 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. |
protected int |
deleteByPrimaryKey(java.lang.Object objectMappingKey,
java.lang.Object primaryKey,
java.sql.Connection connection)
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. |
protected int[] |
deleteByPrimaryKeysBatch(java.lang.Object objectMappingKey,
java.util.Collection primaryKeys)
Deletes the records from the database coresponding to the given primaryKeys, according to the object mapping stored or generated by the given object mapping key. |
protected int[] |
deleteByPrimaryKeysBatch(java.lang.Object objectMappingKey,
java.util.Collection primaryKeys,
java.sql.Connection connection)
Deletes the records from the database coresponding to the given primaryKeys, according to the object mapping stored or generated by the given object mapping key. |
protected IPersistenceConfiguration |
getConfiguration()
Returns the persistence configuration used by this DAO class. |
protected abstract java.sql.Connection |
getConnection()
Override this method to return a database connection to the database you want to connect to. |
protected IObjectMapper |
getObjectMapper()
Returns the object mapper set in the persistence configuration used by this DAO class. |
protected IObjectMapping |
getObjectMapping(java.lang.Object objectMappingKey)
Returns the object mapping stored in the object mapping cache by the given method key. |
protected IObjectMappingCache |
getObjectMappingCache()
Returns the object mapping cache from the persistence configuration used by this DAO class. |
protected IObjectMappingFactory |
getObjectMappingFactory()
A utility method that returns the object mapping factory instance returned by MrPersister.getObjectMappingFactory() . |
protected IObjectReader |
getObjectReader()
Returns the object reader used in the persistence configuration used by this DAO class. |
protected IObjectWriter |
getObjectWriter()
Returns the object writer used in the persistence configuration used by this DAO class. |
protected java.lang.String |
getSqlFromCache(java.lang.Object objectMappingKey,
ISqlCache cache)
Returns the SQL string stored in the given cache by the given object mapping key. |
protected ISqlGenerator |
getSqlGenerator()
Returns the SQL generator used in the persistence configuration used by this DAO class. |
protected java.lang.String |
getTableName(java.lang.Object objectMappingKey)
Override this method to provide a table name for an object mapping key (a class to be mapped) If this method returns null the AbstractDao will ask the ObjectMapper to try to guess the matching table for a class. |
protected int |
insert(java.lang.Object object)
Same as insert(Object objectMappingKey, Object object) , but
uses object.getClass() as the object mapping key. |
protected int |
insert(java.lang.Object object,
java.sql.Connection connection)
Same as insert(Object objectMappingKey, Object object, Connection connection) , but
uses object.getClass() as the object mapping key. |
protected 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. |
protected int |
insert(java.lang.Object objectMappingKey,
java.lang.Object object,
java.sql.Connection connection)
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. |
protected 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. |
protected int[] |
insertBatch(java.util.Collection objects,
java.sql.Connection connection)
Same as insertBatch(Object objectMappingKey, Collection objects, Connection connection)
the class returned by the getClass() of the first element in the collection
as the object mapping key. |
protected 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. |
protected int[] |
insertBatch(java.lang.Object objectMappingKey,
java.util.Collection objects,
java.sql.Connection connection)
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. |
protected 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. |
protected 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. |
protected 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. |
protected 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. |
protected java.lang.Object |
read(java.lang.Object objectMappingKey,
java.lang.String sql,
java.sql.Connection connection)
Reads a single object from the database using the object mapping stored by the given object mapping key, and the given SQL string. |
protected 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. |
protected java.lang.Object |
readByPrimaryKey(java.lang.Object objectMappingKey,
java.lang.Object primaryKey,
java.sql.Connection connection)
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. |
protected 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. |
protected 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. |
protected 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. |
protected 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. |
protected 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. |
protected 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. |
protected 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. |
protected java.util.List |
readList(java.lang.Object objectMappingKey,
java.lang.String sql,
java.sql.Connection connection)
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. |
protected java.util.List |
readList(java.lang.Object objectMappingKey,
java.lang.String sql,
java.sql.Connection connection,
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. |
protected 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. |
protected 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. |
protected java.util.List |
readListByPrimaryKeys(java.lang.Object objectMappingKey,
java.util.Collection primaryKeys,
java.sql.Connection connection)
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. |
protected void |
setConfiguration(IPersistenceConfiguration configuration)
Sets the persistence configuration to be used by this DAO class. |
protected void |
storeSqlInCache(java.lang.Object objectMappingKey,
ISqlCache cache,
java.lang.String sql)
Stores the given SQL string in the given cache. |
protected int |
update(java.lang.Object object)
Same as update(Object objectMappingKey, Object object)
but uses the object.getClass() as the object mapping key. |
protected int |
update(java.lang.Object object,
java.sql.Connection connection)
Same as update(Object objectMappingKey, Object object, Connection connection)
but uses the object.getClass() as the object mapping key. |
protected 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. |
protected int |
update(java.lang.Object objectMappingKey,
java.lang.Object object,
java.sql.Connection connection)
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. |
protected int |
update(java.lang.Object objectMappingKey,
java.lang.Object object,
java.lang.Object oldPrimaryKeyValue)
Deprecated. Use the updateByPrimaryKey instead(). Renamed to avoid naming conflict. |
protected int |
update(java.lang.Object objectMappingKey,
java.lang.Object object,
java.lang.Object oldPrimaryKeyValue,
java.sql.Connection connection)
Deprecated. Use the updateByPrimaryKey method instead. Renamed to avoid naming conflict. |
protected 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. |
protected int[] |
updateBatch(java.util.Collection objects,
java.sql.Connection connection)
Same as updateBatch(Object objectMappingKey, Collection objects, Connection connection)
the class returned by the getClass() of the first element in the collection
as the object mapping key. |
protected 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. |
protected int[] |
updateBatch(java.lang.Object objectMappingKey,
java.util.Collection objects,
java.util.Collection oldPrimaryKeys)
Deprecated. Use the updateBatchByPrimaryKeys instead. Renamed to avoid naming conflict. |
protected int[] |
updateBatch(java.lang.Object objectMappingKey,
java.util.Collection objects,
java.util.Collection oldPrimaryKeys,
java.sql.Connection connection)
Deprecated. Use the updateBatchByPrimaryKeys instead. Renamed to avoid naming conflict. |
protected int[] |
updateBatch(java.lang.Object objectMappingKey,
java.util.Collection objects,
java.sql.Connection connection)
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. |
protected 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. |
protected int[] |
updateBatchByPrimaryKeys(java.util.Collection objects,
java.util.Collection oldPrimaryKeys,
java.sql.Connection connection)
Same as updateBatchByPrimaryKeys(Object objectMappingKey, Collection objects, Collection oldPrimaryKeys,
Connection connection) but uses the class returned by the getClass() method of the first object
in the collection as the object mapping key. |
protected 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. |
protected int[] |
updateBatchByPrimaryKeys(java.lang.Object objectMappingKey,
java.util.Collection objects,
java.util.Collection oldPrimaryKeys,
java.sql.Connection connection)
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. |
protected 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. |
protected int |
updateByPrimaryKey(java.lang.Object object,
java.lang.Object oldPrimaryKeyValue,
java.sql.Connection connection)
Same as updateByPrimaryKey(Object objectMappingKey, Object object, Object oldPrimaryKeyValue,
Connection connection) but uses the object.getClass() as the object mapping key. |
protected 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. |
protected int |
updateByPrimaryKey(java.lang.Object objectMappingKey,
java.lang.Object object,
java.lang.Object oldPrimaryKeyValue,
java.sql.Connection connection)
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected IPersistenceConfiguration configuration
Constructor Detail |
---|
public AbstractDao()
Method Detail |
---|
protected abstract java.sql.Connection getConnection() throws PersistenceException
PersistenceException
protected void close(java.sql.ResultSet result) throws PersistenceException
ResultSet
result
- The ResultSet
to close.
PersistenceException
- If the ResultSet
could not be closed.protected void close(java.sql.Statement statement) throws PersistenceException
Statement
statement
- The Statement
to close.
PersistenceException
- If the Statement
could not be closed.protected void close(java.sql.PreparedStatement statement) throws PersistenceException
PreparedStatement
statement
- The PreparedStatement
to close.
PersistenceException
- If the PreparedStatement
could not be closed.protected void close(java.sql.Connection connection) throws PersistenceException
Connection
connection
- The Connection
to close.
PersistenceException
- If the Connection
could not be closed.protected IObjectMappingFactory getObjectMappingFactory()
MrPersister.getObjectMappingFactory()
. This method just
makes it easier to access the object mapping factory.
protected IPersistenceConfiguration getConfiguration() throws PersistenceException
IPersistenceConfiguration
used by this DAO class.
PersistenceException
- If no persistence configuration is set.protected void setConfiguration(IPersistenceConfiguration configuration)
configuration
- The IPersistenceConfiguration
to be used by this
DAO class.protected java.lang.String getTableName(java.lang.Object objectMappingKey)
protected String getTableName(Object objectMappingKey) {
if(Employee.class.equals(objectMappingKey)){ return “workers”; }
return null;
}
- Parameters:
objectMappingKey
- The object mapping key to check for a specific table name for.
- Returns:
- The specific table name to map the given class to, or null if the ObjectMapper is
try to guess the table name.
protected IObjectMapping createManualObjectMapping(java.lang.Object objectMappingKey) throws PersistenceException
objectMappingKey
- The object mapping key of the class to be mapped.
PersistenceException
- If anything goes wrong during the creation of the object mapping.protected IObjectMapping createObjectMapping(java.lang.Class theClass) throws PersistenceException
theClass
- The class to create the object mapping for.
PersistenceException
- If no IObjectMapper is present in the IPersistenceConfiguration in this
DAO instance. Also if something goes wrong during the method.protected IObjectMapping createObjectMapping(java.lang.Class theClass, java.lang.String tableName) throws PersistenceException
theClass
- The class to generate an object mapping for.tableName
- The name of the table to map the given class to.
PersistenceException
- If anything goes wrong during the method, or if no
object mapper set in the persistence configuration.protected IObjectMapper getObjectMapper() throws PersistenceException
PersistenceException
- If no object mapper is set in the used persistence configuration.protected IObjectMappingCache getObjectMappingCache() throws PersistenceException
PersistenceException
- If no persistence configuration is set for this DAO class.protected IObjectMapping getObjectMapping(java.lang.Object objectMappingKey) throws PersistenceException
createManualObjectMapping(objectMappingKey)
will be called to see if the
concrete AbstractDao subclass
has a manual object mapping it wants to use for the given object mapping key.
createManualObjectMapping()
returns null, then this method will call
the getTableName(objectMappingKey)
to see if the concrete AbstractDao subclass wants
to map the object to a certain database table, that cannot be guessed automatically
from the name of the mapped class. If getTableName(objectMappingKey)
returns null,
a new object mapping is auto-generated if possible. An object mapping can be generated if the method key
used is a Class
instance (f.x. Employees.class), or an instance of
ObjectMappingKey
with a Class
instance filled in.
If an object mapping is generated it will be stored in the object
method cache under the given method key for later use.
Class
instance should be the class of the object to be stored, meaning
if you want to store objects of the class Employee, the class instance should be
Employee.class.
objectMappingKey
- The key by which the object mapping to return is stored.
PersistenceException
- If no object mapping is stored in the object mapping cache and
no object mapping could be generated, or if something goes wrong during the
generation of the object mapping if one can be generated.protected IObjectReader getObjectReader() throws PersistenceException
IObjectReader
instance set in the persistence configuration used
by this DAO class.
PersistenceException
- If no IObjectReader
instance is set in the
used persistence configuration.protected IObjectWriter getObjectWriter() throws PersistenceException
IObjectWriter
instance set in the persistence configuration used
by this DAO class.
PersistenceException
- If no IObjectWriter
instance is set in the
used persistence configuration.protected ISqlGenerator getSqlGenerator() throws PersistenceException
ISqlGenerator
instance set in the persistence configuration used by this DAO class.
PersistenceException
- If no ISqlGenerator
instance is set in the
used persistence configuration.protected java.lang.String getSqlFromCache(java.lang.Object objectMappingKey, ISqlCache cache)
objectMappingKey
- The object mapping key by which the desired SQL string is stored.cache
- The ISqlCache
instance in which the desired SQL string is stored.
protected void storeSqlInCache(java.lang.Object objectMappingKey, ISqlCache cache, java.lang.String sql)
objectMappingKey
- The object mapping key under which to store the SQL string.cache
- The ISqlCache
to store the SQL string in.sql
- The SQL string to store.protected 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.protected java.lang.Object readByPrimaryKey(java.lang.Object objectMappingKey, java.lang.Object primaryKey, java.sql.Connection connection) 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.connection
- The database connection to use for the operation.
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.protected 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.protected java.lang.Object read(java.lang.Object objectMappingKey, java.lang.String sql, java.sql.Connection connection) 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.connection
- The database connection to use for the operation.
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.protected 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.protected 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.protected 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.protected 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.protected java.util.List readListByPrimaryKeys(java.lang.Object objectMappingKey, java.util.Collection primaryKeys, java.sql.Connection connection) 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.connection
- The database connection to use for the operation.
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.protected 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.protected java.util.List readList(java.lang.Object objectMappingKey, java.lang.String sql, java.sql.Connection connection) 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.connection
- The database connection to use for the operation.
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.protected 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.protected 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.protected 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.protected 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.protected java.util.List readList(java.lang.Object objectMappingKey, java.lang.String sql, java.sql.Connection connection, 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.connection
- The database connection to use for the operation.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.protected 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.protected 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.protected 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.protected 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.protected 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.protected int insert(java.lang.Object objectMappingKey, java.lang.Object object, java.sql.Connection connection) throws PersistenceException
com.jenkov.mrpersister.impl.method.ObjectMappingKey
instance
with a Class
instance set
(calling ObjectobjectMappingKey'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.connection
- The database connection to use for the operation.
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.protected int insert(java.lang.Object object, java.sql.Connection connection) throws PersistenceException
insert(Object objectMappingKey, Object object, Connection connection)
, but
uses object.getClass() as the object mapping key.
object
- The object containing the values to be inserted into the new record.connection
- The database connection to use for the operation.
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.protected 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.protected 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.protected int[] insertBatch(java.lang.Object objectMappingKey, java.util.Collection objects, java.sql.Connection connection) 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.connection
- The database connection to use for the operation.
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.protected int[] insertBatch(java.util.Collection objects, java.sql.Connection connection) throws PersistenceException
insertBatch(Object objectMappingKey, Collection objects, Connection connection)
the class returned by the getClass() of the first element in the collection
as the object mapping key.
objects
- The object containing the values to be inserted into the new record.connection
- The database connection to use for the operation.
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.protected 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.protected 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.protected int update(java.lang.Object objectMappingKey, java.lang.Object object, java.sql.Connection connection) 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.connection
- The database connection to use for the operation.
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.protected int update(java.lang.Object object, java.sql.Connection connection) throws PersistenceException
update(Object objectMappingKey, Object object, Connection connection)
but uses the object.getClass() as the object mapping key.
object
- The object containing the values to be update in the coresponding record.connection
- The database connection to use for the operation.
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.protected int update(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.protected 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.protected 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.protected int update(java.lang.Object objectMappingKey, java.lang.Object object, java.lang.Object oldPrimaryKeyValue, java.sql.Connection connection) 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.connection
- The database connection to use for the operation.
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.protected int updateByPrimaryKey(java.lang.Object objectMappingKey, java.lang.Object object, java.lang.Object oldPrimaryKeyValue, java.sql.Connection connection) 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.connection
- The database connection to use for the operation.
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.protected int updateByPrimaryKey(java.lang.Object object, java.lang.Object oldPrimaryKeyValue, java.sql.Connection connection) throws PersistenceException
updateByPrimaryKey(Object objectMappingKey, Object object, Object oldPrimaryKeyValue,
Connection connection)
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.connection
- The database connection to use for the operation.
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.protected 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.protected 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.protected int[] updateBatch(java.lang.Object objectMappingKey, java.util.Collection objects, java.sql.Connection connection) 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.connection
- The database connection to use for the operation.
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.protected int[] updateBatch(java.util.Collection objects, java.sql.Connection connection) throws PersistenceException
updateBatch(Object objectMappingKey, Collection objects, Connection connection)
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.protected int[] updateBatch(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.
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.protected 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.protected 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.protected int[] updateBatch(java.lang.Object objectMappingKey, java.util.Collection objects, java.util.Collection oldPrimaryKeys, java.sql.Connection connection) 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.connection
- The database connection to use for the operation.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.protected int[] updateBatchByPrimaryKeys(java.lang.Object objectMappingKey, java.util.Collection objects, java.util.Collection oldPrimaryKeys, java.sql.Connection connection) 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.connection
- The database connection to use for the operation.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.protected int[] updateBatchByPrimaryKeys(java.util.Collection objects, java.util.Collection oldPrimaryKeys, java.sql.Connection connection) throws PersistenceException
updateBatchByPrimaryKeys(Object objectMappingKey, Collection objects, Collection oldPrimaryKeys,
Connection connection)
but uses the class returned by the getClass() method of the first object
in the collection as the object mapping key.
objects
- The collection of objects containing the values for the records to be updated.connection
- The database connection to use for the operation.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.protected 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 a "?" character for the primary key value 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 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.protected 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.protected int delete(java.lang.Object objectMappingKey, java.lang.Object object, java.sql.Connection connection) 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 a "?" character for the primary key value 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 primary key of the record to be deleted.connection
- The database connection to use for the operation.
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.protected int delete(java.lang.Object object, java.sql.Connection connection) throws PersistenceException
delete(Object objectMappingKey, Object object, Connection connection)
but uses
the object.getClass() as the object mapping key.
object
- The object containing the primary key of the record to be deleted.connection
- The database connection to use for the operation.
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.protected 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 a "?" character for the primary key value 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 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.protected 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.protected int[] deleteBatch(java.lang.Object objectMappingKey, java.util.Collection objects, java.sql.Connection connection) 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 a "?" character for the primary key value 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 containing the objects to be deleted.connection
- The database connection to use for the operation.
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.protected int[] deleteBatch(java.util.Collection objects, java.sql.Connection connection) throws PersistenceException
deleteBatch(Object objectMappingKey, Collection objects, Connection connection)
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.connection
- The database connection to use for the operation.
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.protected 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 a "?" character for the primary key value 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.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.protected int deleteByPrimaryKey(java.lang.Object objectMappingKey, java.lang.Object primaryKey, java.sql.Connection connection) 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 a "?" character for the primary key value 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.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.protected int[] deleteByPrimaryKeysBatch(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 delete,
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 a "?" character for the primary key value 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.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.protected int[] deleteByPrimaryKeysBatch(java.lang.Object objectMappingKey, java.util.Collection primaryKeys, java.sql.Connection connection) 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 delete,
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 a "?" character for the primary key value 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.primaryKeys
- The collection containing the primary keys of the records to be deleted.connection
- The database connection to use for the operation.
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |