NamedQuery (Hibernate JavaDocs)
Date: 2012-04-05

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT

## org.hibernate.annotations
Annotation Type NamedQuery

    @Target(value={TYPE,PACKAGE})
    @Retention(value=RUNTIME)
    public @interface NamedQuery

Extends `NamedQuery` with Hibernate features

Required Element Summary
`String` | `name`
`String` | `query`

Optional Element Summary
`boolean` | `cacheable`
`CacheModeType` | `cacheMode`
`String` | `cacheRegion`
`String` | `comment`
`int` | `fetchSize`
`FlushModeType` | `flushMode`
`boolean` | `readOnly`
`int` | `timeout`

Element Detail

### name

    public abstract String name

  Returns:
    returns the name of this `NamedQuery`

### query

    public abstract String query

  Returns:
    returns the query string for this `NamedQuery`

### flushMode

    public abstract FlushModeType flushMode

  Returns:
    returns the flush mode for this query
  Default:
    org.hibernate.annotations.FlushModeType.PERSISTENCE_CONTEXT

### cacheable

    public abstract boolean cacheable

  Returns:
    returns whether this query is cacheable or not
  Default:
    false

### cacheRegion

    public abstract String cacheRegion

  Returns:
    returns the the cache region to use
  Default:
    ""

### fetchSize

    public abstract int fetchSize

  Returns:
    returns the number of rows fetched by the JDBC Driver per database round-trip
  Default:
    -1

### timeout

    public abstract int timeout

  Returns:
    return the query timeout in seconds
  Default:
    -1

### comment

    public abstract String comment

  Returns:
    returns the comment added to the SQL query (useful for the DBA)
  Default:
    ""

### cacheMode

    public abstract CacheModeType cacheMode

  Returns:
    returns the cache mode used for this query
  Default:
    org.hibernate.annotations.CacheModeType.NORMAL

### readOnly

    public abstract boolean readOnly

  Returns:
    returns whether the results are fetched in read-only mode or not. Default is `false`
  Default:
    false

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT

Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.