Package com.github.ddth.dao
Interface IGenericBoDao<T>
-
- All Known Implementing Classes:
GenericBoJdbcDao
public interface IGenericBoDao<T>
API interface for DAO that manages one single BO class.- Since:
- 0.8.0
- Author:
- Thanh Nguyen
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description DaoResult
create(T bo)
Create/Persist a new BO to storage.default DaoResult
createOrUpdate(T bo)
Create a new BO or update an existing one.DaoResult
delete(T bo)
Delete an existing BO from storage.T
get(BoId id)
Fetch an existing BO from storage by id.T[]
get(BoId... idList)
Fetch list of existing BOs from storage by id.java.util.stream.Stream<T>
getAll()
Fetch all existing BOs from storage and return the result as a stream.java.util.stream.Stream<T>
getAllSorted()
Fetch all existing BOs from storage, sorted by primary key(s) and return the result as a stream.DaoResult
update(T bo)
Update an existing BO.default DaoResult
updateOrCreate(T bo)
Update an existing BO or create a new one.
-
-
-
Method Detail
-
create
DaoResult create(T bo) throws DaoException
Create/Persist a new BO to storage.- Parameters:
bo
-- Returns:
- Throws:
DaoException
-
delete
DaoResult delete(T bo) throws DaoException
Delete an existing BO from storage.- Parameters:
bo
-- Returns:
- Throws:
DaoException
-
get
T get(BoId id) throws DaoException
Fetch an existing BO from storage by id.- Parameters:
id
-- Returns:
- Throws:
DaoException
-
get
T[] get(BoId... idList) throws DaoException
Fetch list of existing BOs from storage by id.- Parameters:
idList
-- Returns:
- Throws:
DaoException
-
getAll
java.util.stream.Stream<T> getAll() throws DaoException
Fetch all existing BOs from storage and return the result as a stream.- Returns:
- Throws:
DaoException
- Since:
- 0.9.0
-
getAllSorted
java.util.stream.Stream<T> getAllSorted() throws DaoException
Fetch all existing BOs from storage, sorted by primary key(s) and return the result as a stream.- Returns:
- Throws:
DaoException
- Since:
- 0.9.0
-
update
DaoResult update(T bo) throws DaoException
Update an existing BO.- Parameters:
bo
-- Returns:
- Throws:
DaoException
-
createOrUpdate
default DaoResult createOrUpdate(T bo) throws DaoException
Create a new BO or update an existing one.- Parameters:
bo
-- Returns:
- Throws:
DaoException
- Since:
- 0.8.1
-
updateOrCreate
default DaoResult updateOrCreate(T bo) throws DaoException
Update an existing BO or create a new one.- Parameters:
bo
-- Returns:
- Throws:
DaoException
- Since:
- 0.8.1
-
-