ObjectDB ObjectDB

Internal Website Search

1-10 of 200 resultsRefresh

JPA Named Queries

A named query is a statically defined query with a predefined unchangeable query string. Using named queries instead of dynamic queries may improve code organization by separating the JPQL query ... and @NamedQueries Annotations The following @NamedQuery annotation defines a query whose name is "Country.findAll

Query Parameters in JPA

execution, because it eliminates the need for repeated query compilations. Named Parameters (:name ... getCountryByName(EntityManager em, String name) { TypedQuery<Country> query = em.createQuery( "SELECT c FROM Country c WHERE c.name = :name", Country.class); return query.setParameter


because it introduces the Country class to ObjectDB. Dynamic JPQL, Criteria API and Named Queries ... for building static queries, as named queries, using the @NamedQuery and @NamedQueries annotations. It is considered to be a good practice in JPA to prefer named queries over dynamic queries when possible

JPA Criteria API Queries

.g. as named queries) may be preferred. For dynamic queries that are built at runtime - the criteria ... The JPA Criteria API provides an alternative way for defining JPA queries, which is mainly useful for building dynamic queries whose exact structure is only known at runtime. JPA Criteria API vs JPQL

Setting and Tuning of JPA Queries

>        <property name="javax.persistence.query.timeout" value="3000"/> </properties ... ); For a named query definition - using the hints element: @NamedQuery(name="Country.findAll", query="SELECT c FROM Country c",     hints={@QueryHint(name="javax.persistence.query.timeout", value="7000

Running JPA Queries

that to only print the country names, a query using projection and retrieving country names directly ... a single Country object: Query query = em.createQuery( "SELECT c FROM Country c WHERE c.name ... The Query interface defines two methods for running SELECT queries: Query.getSingleResult - for use


. Applying changes to the database by calling the commit method. JPQL UPDATE queries provide an alternative way of updating entity objects. Unlike SELECT queries, which are used to retrieve data from the database, UPDATE queries do not retrieve data from the database, but when executed, update

JPA Query Structure (JPQL / Criteria)

The syntax of the Java Persistence Query Language (JPQL) is very similar to the syntax of SQL. Having an SQL-like syntax in JPA queries is an important advantage because SQL is a very powerful query ... classes and objects. For example, a JPQL query can retrieve and return entity objects

Literals in JPQL and Criteria Queries

specifying another name explicitly in the @Entity's name annotation element. Criteria Query Literals ... literals should be used sparingly as queries that use parameters instead of literals ... values. Literals should only be embedded in JPQL queries when a single constant value is always used

[ODB1] Chapter 7 - JDOQL Queries

when the query is executed. Class Person must have a persistent field with the name birthDate and type ... = (Collection)query.executeWithArray(args); Arguments can also be passed in a map (by names ... = (Collection)query.execute(date); The full name of class Date is specified because that class is in

Getting Started

ObjectDB is very easy to use. Follow the Getting Started Tutorial and the Quick Tour manual chapter and in minutes you may be able to write and run first Java programs against ObjectDB.

Prior knowledge or experience in database programming (SQL, JDBC, ORM, JPA, etc.) is not required, but some background in using the Java language is essential.

Need Help?

  1. Search ObjectDB website
  2. Read the FAQ
  3. Follow the Tutorials
  4. View or post in the forum
  5. Search or file an issue
  6. Contact support