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

  • It deletes an entity by its primary key.
  • It marks the entity as deleted but does not remove it from the database.
  • It deletes all entities in the repository.
  • It deletes an entity based on a custom query.
The deleteById method of a JpaRepository deletes an entity from the database by its primary key. It is a convenient method for removing specific entities based on their unique identifier. The other options do not accurately describe the behavior of this method; in particular, it does not mark the 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 *