I
- type of the persistent object and transport object id.
This type should be immutable. It is critical this type
implements equals() and hashCode() correctly.P
- type of the persistent object.T
- type of the transport object.F
- type of the associated filter.S
- type of the associated sort specification type.C
- type of the data store execution context.public interface Dao<I extends Serializable,T extends TransportObject<? super T,I>,P extends Storable<I>,F,S,C> extends BaseDao<I,P,F,S,C>, Converter<P,T>
Dao
is the Data Access Object.
This is the layer that abstracts the underlying database implementation
from the business logic. The interface methods
provided by the DAO do not change when the underlying database is changed.
Thus, it provides ability for plugging in and out of any underlying
implementation without affecting the upper layers.Modifier and Type | Method and Description |
---|---|
P |
create(T transportable,
C context)
Creates a new persistent object with the data from the given transport
object.
|
long |
delete(F filter,
C context)
Deletes all persistent objects matching the given filter.
|
<E extends T> |
delete(Id<E,I> id,
C context)
Deletes the persistent object with the given id.
|
long |
deleteAll(C context)
Deletes all the persistent objects.
|
P |
update(T transportable,
C context)
Updates the persistent object related to the given transport object.
|
P create(T transportable, C context) throws Exception
transportable
- transport object to get the data from.context
- data store context.Exception
- in case of error occurs while creating the data.P update(T transportable, C context) throws Exception
transportable
- transport object to get the data from.context
- data store context.Exception
- in case error occurs while updating the data.<E extends T> Boolean delete(Id<E,I> id, C context) throws Exception
id
- persistent object's id.context
- data store context.true
if the persistent object was found and deleted,
false
if it was not found.Exception
- throws if delete fails to operate.long delete(F filter, C context) throws Exception
filter
- filter.context
- data store context.Exception
- throws if delete fails to operate.Copyright © 2015. All Rights Reserved.