Monday, October 13, 2014

Hibernate - delete query example

Delete query by parent. Annotation approach used and this code is placed in repository class (interface):
    @Modifying
    @Query("DELETE FROM Child WHERE parent = :parent")
    public void deleteAllForParent( @Param("parent") Parent parent );

Child class has field named parent.

No comments:

Post a Comment