SQL Queries Annotations

Jakarta Persistence (JPA) provides a set of annotations to define and map native SQL queries

when the standard Java Persistence Query Language (JPQL) is insufficient. While ObjectDB focuses on JPQL and ignores these annotations, they remain essential for applications interacting with relational databases through specific SQL dialects.

Native query definitions

Define raw SQL queries using the following annotations:

Specifies a named native SQL query using the underlying database's specific SQL dialect.

Groups multiple @NamedNativeQuery definitions on a single class.

Result set mapping

Map the results of native SQL queries to entities or scalar values using these annotations:

Defines how the result set of a native query maps to entities, scalar values, or constructor results.

Groups multiple @SqlResultSetMapping definitions.

Mapping details

Refine the mapping of specific columns to entity fields or scalar types with these detailed annotations:

Maps a native query result to a specific entity class.

Maps a specific SQL column to an entity field or property within an @EntityResult.

Maps a result set column directly to a scalar value.