Which of the following is true about the deleteById method of a JpaRepository?

  • It deletes an entity by its primary key and returns the deleted entity.
  • It deletes all entities in the repository and returns the number of deletions.
  • It marks the entity as "deleted" but does not physically remove it from the database.
  • It is not a standard method provided by JpaRepository.
The deleteById method of a JpaRepository deletes an entity by its primary key and returns the deleted entity. This method is a convenient way to remove a specific entity from the database. The other options do not accurately describe the behavior of this method, as it neither deletes all entities nor marks an entity as "deleted" without removing it from the database.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *