Package org.hibernate.annotations
Annotation Interface SQLDelete
@Target({TYPE,FIELD,METHOD})@Retention(RUNTIME)@Repeatable(SQLDeletes.class)public @interfaceSQLDelete
Specifies a custom SQL DML statement to be used in place of the default SQL generated by Hibernate when an entity or collection row is deleted from the database.
The givenSQL statement must have exactly the number of JDBC? parameters that Hibernate expects, in the exact order Hibernate expects. The primary key columns come before the version column if the entity is versioned.
If an entity hassecondary tables, it may have a@SQLDelete annotation for each secondary table. Thetable() member must specify the name of the secondary table.
Required Element Summary
Required ElementsOptional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanIs the statement callable (aka aCallableStatement)?Deprecated, for removal: This API element is subject to removal in a future version.useverify()with anExpectationclassThe name of the table affected by the delete statement.Class<? extendsExpectation>AnExpectationclass used to verify that the operation was successful.
Element Details
sql
String sqlProcedure name or SQLDELETEstatement.
callable
boolean callableIs the statement callable (aka aCallableStatement)?- Default:
- false
verify
Class<? extendsExpectation> verifyAnExpectationclass used to verify that the operation was successful.- Default:
- org.hibernate.jdbc.Expectation.class
check
Deprecated, for removal: This API element is subject to removal in a future version.useverify()with anExpectationclassAResultCheckStyleused to verify that the operation was successful.- Default:
- NONE
table
String tableThe name of the table affected by the delete statement. Required when the statement affects asecondary table of an entity. Not required for collections nor when the insert statement affects the primary table of an entity.- Returns:
- the name of the secondary table
- Since:
- 6.2
- Default:
- ""