public class PojoRepository<E> extends java.lang.Object implements CrudRepository<E>
| Constructor and Description |
|---|
PojoRepository(org.jooq.DSLContext db,
java.lang.Class<E> type)
Create a new repository for performing CRUD operations on POJOs.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
create(E entity)
Insert an entity into the database.
|
void |
createMany(java.util.List<E> entities)
Insert a list of entities into the database.
|
boolean |
delete(E entity)
Delete an entity from the database.
|
java.util.List<E> |
readAll()
Get all entities of type
<E> from the database. |
java.util.List<E> |
readAllWhere(org.jooq.Condition condition)
Get all entities of type
<E> from the database where a certain condition is met. |
E |
readOneWhere(org.jooq.Condition condition)
Get a single entity of type
<E> from the database where a certain condition is met. |
boolean |
updateWhere(E entity,
org.jooq.Condition condition)
Replace entities in the database with the provided entity where a specific condition is met.
|
public PojoRepository(org.jooq.DSLContext db,
java.lang.Class<E> type)
db - a pre-configured jOOQ DSLContexttype - the POJO classpublic boolean create(E entity)
CrudRepositorycreate in interface CrudRepository<E>entity - the entity to persisttrue if successful, false otherwisepublic void createMany(java.util.List<E> entities)
CrudRepositorycreateMany in interface CrudRepository<E>entities - the entities to persistpublic java.util.List<E> readAll()
CrudRepository<E> from the database.readAll in interface CrudRepository<E>public java.util.List<E> readAllWhere(org.jooq.Condition condition)
CrudRepository<E> from the database where a certain condition is met.readAllWhere in interface CrudRepository<E>condition - the condition to meetpublic E readOneWhere(org.jooq.Condition condition)
CrudRepository<E> from the database where a certain condition is met.readOneWhere in interface CrudRepository<E>condition - the condition to meetnull if there are no resultspublic boolean updateWhere(E entity, org.jooq.Condition condition)
CrudRepositoryupdateWhere in interface CrudRepository<E>entity - the entity to replace the entities withcondition - the condition to meettrue if the update was successful, false otherwisepublic boolean delete(E entity)
CrudRepositorydelete in interface CrudRepository<E>entity - the entity to delete from the databasetrue if the entity was deleted, false otherwiseCopyright © 2021. All rights reserved.