findAll()
method : It retrieves all the saved entities.
findById(ID id)
method : It retrieves the entity by ID given as input.
findAllById(Iterable<ID> ids)
: It retrives the list of entities which matches the list of input Ids.
existsById(ID id)
: It returns true or false, depending upon the entity with input Id exists or not in the database.
save(Entity entity)
: To save the entity and similarly saveAll(Iterable<ENTITY>
entities) to save the list of entities.
Know that there are delete(Entity)
, deleteById(ID)
, deleteAll()
, and deleteAll(Iterable<ID>
ids) methods are also there but it is rarely used by a developer in a project in comparison to other method. Hence, skip these and tell only if interviewer asks them explicitly.