Annotation Interface NamedNativeStatement
@Repeatable(NamedNativeStatements.class)
@Target(TYPE)
@Retention(RUNTIME)
public @interface NamedNativeStatement
Declares a named statement written in
native SQL. Statement names are scoped to the persistence unit.
The SQL statement must return a row count.
This annotation may be applied to any class or interface belonging to the persistence unit.
@NamedNativeStatement(name = "deleteNamedCustomers",
statement = "delete from Customer c where c.name like :custName")
@Entity
class Customer { ... }
A named statement may be executed by calling
EntityHandler.createNamedStatement(String).
em.createNamedStatement("deleteNamedCustomers")
.setParameter("custName", "Smith")
.execute();
- Since:
- 4.0
- See Also:
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescription(Required) The name used to identify the query in calls toEntityHandler.createNamedStatement(String).(Required) The statement string written in native SQL. -
Optional Element Summary
Optional Elements
-
Element Details
-
name
String name(Required) The name used to identify the query in calls toEntityHandler.createNamedStatement(String). -
statement
String statement(Required) The statement string written in native SQL. -
hints
QueryHint[] hints(Optional) Query properties and hints. May include vendor-specific query hints.- See Also:
- Default:
{}
-