NPersistence Reference Guide
Assembly: NPersistence (in NPersistence.dll) Version: 2.0.0.0 (2.0.0.0)
Specifies a static, named query in the Java Persistence query language.
Query names are scoped to the persistence unit.
The following is an example of the use of a named query:
Namespace: NPersistenceThe NamedQuery annotation can be applied to an entity or mapped superclass.
The following is an example of the definition of a named query in the Java Persistence query language:
Examples
CopyC#
[NamedQuery( name="findAllCustomersWithName", query="SELECT c FROM Customer c WHERE c.name LIKE :custName"] )
Examples
CopyC#
[PersistenceContext] public EntityManager em; ... customers = em.createNamedQuery("findAllCustomersWithName") .setParameter("custName", "Smith") .getResultList();
Assembly: NPersistence (in NPersistence.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax
C# |
public sealed class NamedQuery : Attribute
Members
All Members | Constructors | Fields |
Public Protected | Instance Static | Declared Inherited | XNA Framework Only .NET Compact Framework Only |
Member | Description | |
---|---|---|
NamedQuery()()()() | Initializes a new instance of the NamedQuery class | |
Hints | (Optional) Query properties and hints. May include
vendor-specific query hints.
| |
LockMode |
(Optional) The lock mode type to use in query execution. If a lockMode
other than LockModeType.NONE is specified, the query must be executed in
a transaction.
| |
Name |
(Required) The name used to refer to the query with the EntityManager
methods that create query objects.
| |
Query | (Required)
The query string in the Java Persistence query language.
|
Inheritance Hierarchy
System..::..Object
System..::..Attribute
NPersistence..::..NamedQuery
System..::..Attribute
NPersistence..::..NamedQuery