NamedQuery feature in Hibernate allows Queries to added in Entity or Mapping Documents.The Queries can be of HQL or SQL type.NamedQuery structure has a name and query part.The name identifies the Query and should be unique in the context.If there are multiple named queries for an Entity,it can be specified within a NamedQueries construct.
@NamedQueries({
@NamedQuery(
name = "findEmpByAge",
query = "from emp e where e.age>?"
),
@NamedQuery(
name = "findEmpByRole",
query = "from emp e where e.role=?"
)
})
Books
12 years ago
No comments:
Post a Comment