ObjectDB Database Search

1-50 of 200 results

Retrieving JPA Entities

Jakarta Persistence (JPA) provides various ways to retrieve objects from the database. Retrieving ... . The persistence context serves as a cache for retrieved entities. If a requested entity is not in ... entity and returns it to the application. The construction of a new managed object during retrieval

JPA Shared (L2) Entity Cache

that it manages. The persistence context serves as a first-level cache. Retrieving an entity ... the following functionality: On retrieval : The shared cache is used for entities that are not in the persistence context. If an entity is not in the shared cache, it is retrieved from the database

JPA Optimistic and Pessimistic Locking

after the current transaction retrieved it, so the current transaction is attempting to modify a stale version ... retrieved it. Optimistic locking is completely automatic and enabled by default in ObjectDB, regardless ... .persistence.lock.timeout", 4000); In addition, the hint can be set for a specific retrieval operation or

JPA Persistable Types

store and retrieval operations. Therefore, using embeddable classes can save space in the database ... and retrieval ). Simplifies queries on dates and date ranges. When an entity is stored, its date ... to a similar supported type when it retrieves the data from the database. For example, the Arrays

Managing JPA Entities

for many operations, including storing, retrieving , updating, and deleting database objects ... . Entities that an EntityManager retrieves from the database are also in the Managed state. The Retrieving Entities section discusses object retrieval in more detail. If a managed entity is modified

JPA Metamodel API

The JPA Metamodel API enables you to examine the persistent object model and retrieve details ... retrieve sets of types: // Get all the managed classes: // (entity classes, embeddable classes, mapped ... all types whose instances are already stored in the database. Three additional methods retrieve

JPA Entity Fields

an automatic query when the entity is retrieved . Note : Navigation through inverse fields ... when a Department entity is retrieved from the database. ObjectDB accomplishes this by effectively running ... , you can set the order of the retrieved owner entities by using the @OrderBy annotation: @Entity

UPDATE SET Queries in JPA/JPQL

You can update existing entities, as explained in chapter 2 , by following these steps: Retrieve ... an alternative way to update entities. Unlike SELECT queries, which retrieve data, UPDATE queries modify specified entities directly in the database without retrieving them first. Using an UPDATE query

JPA Primary Key

and can be retrieved by the combination of its type and its primary key. Primary key values must be unique for each ... . However, an ID class is required to retrieve entities by their primary key, as shown in the Retrieving Entities section. Embedded primary key An alternative way to represent a composite primary key

SELECT clause (JPQL / Criteria API)

The ability to retrieve managed entities is a key advantage of JPQL. For example, the following ... the FROM clause. Nested path expressions are also supported. For example, the following query retrieves ... with the containing entities. Therefore, embedded objects that are retrieved directly by a result path expression

FROM clause (JPQL / Criteria API)

, consider the following INNER JOIN query that retrieves pairs of country names and capital names: SELECT c ... over the results is inefficient because the referenced Capital objects are retrieved one at a time ... of iteration over the result Country objects because it eliminates the need to retrieve

Logical Operators in JPQL and Criteria API

supports both notations. Binary AND (&&) operator The following query retrieves countries whose population ... for AND . Binary OR (||) operator The following query retrieves countries whose population or area exceeds ... The following query retrieves all countries whose population does not exceed a specified limit: SELECT c FROM

JPA Query Structure (JPQL / Criteria)

operates on Java classes and objects. For example, a JPQL query can retrieve entities, unlike SQL ... ...]] [ORDER BY ...] The SELECT and FROM clauses are required in every query that retrieves data; update ... values). A Minimal JPQL Query The following query retrieves all Country objects from the database

DELETE Queries in JPA/JPQL

: Retrieve the entities into an EntityManager . Remove these objects from the EntityManager ... an alternative way to delete entities. Unlike SELECT queries, which retrieve data from the database ... can be more efficient than retrieving and then removing them. However, you should use this approach

WHERE clause (JPQL / Criteria API)

for retrieving a specific subset of objects from the database. How a WHERE clause works The following query retrieves only countries with a population greater than the value of the parameter p : SELECT c ... , the following query retrieves all countries that have a population greater than a specified limit

JPA Criteria Queries

Build top-level retrieval queries using the main criteria query interface: Use this interface ... functionality through their common parent: This base interface defines the common structure of retrieval ... : UPDATE and DELETE Queries CriteriaQuery is designed exclusively for data retrieval . Bulk data

jakarta.persistence.StoredProcedureQuery

have been exhausted, results returned through INOUT and OUT parameters can be retrieved . The getOutputParameterValue methods are used to retrieve the values passed back from the procedure ... should be exhausted before calling getResultList to retrieve the result set. Alternatively, the REF_CURSOR

Setting and Tuning of JPA Queries

the page number (starting from 0 for the first page), the following code retrieves the results ... to all result objects that the query retrieves . For example, the following code sets a pessimistic WRITE

JPA Named Queries Annotations

). It is defined on an entity or mapped superclass and assigned a unique name for retrieval ... . Retrieve it by result type from EntityManagerFactory.getNamedQueries , and use it to get a TypedQuery instance via EntityManager.createQuery .

JPA Runtime Tuning & Configuration

to find() and lock() . Cache retrieve mode Controls whether data is read from the second-level cache: USE or BYPASS . Scope Usage EntityManagerFactory Set the PersistenceConfiguration.CACHE_ RETRIEVE _MODE

JPA Metamodel and Graphs

to retrieve entity and attribute information by class or name, similar to the reflection API in Java ... . It is the common super-interface of both EntityType and Attribute . Retrieval optimization with graphs

Query Parameters in JPA

Query parameters enable you to define reusable queries. You can execute these queries with different parameter values to retrieve different results. Executing the same query multiple times ... because it eliminates repeated query compilations. Named Parameters (:name) The following method retrieves

Running JPA Queries

()) The following query retrieves all the Country objects in the database. Use the getResultList() method ... to retrieve only the names instead of the entire Country instances. Single-result query execution

Updating JPA Entities

Modifying existing entities in the database relies on transparent persistence, which automatically detects and handles changes. Transparent update After an entity is retrieved from the database ... when it is retrieved from the database and then compare that snapshot to the object's current state

Chapter 1 - Quick Tour

ObjectDB databases and perform basic CRUD (Create, Retrieve , Update, and Delete) operations ... coordinates. The program demonstrates CRUD database operations by storing, retrieving , updating, and deleting

JPA Exceptions

and locking exceptions Lock acquisition failures during updates or retrieval are indicated by: Thrown ... locking wait times. Query exceptions Exceptions specific to query execution and result retrieval

JPA Lifecycle Events

). @PostLoad : Invoked after an entity is retrieved from the database. @PreUpdate : Invoked

Detached JPA Entities

Detached entities are objects in a special state where they are not managed by an EntityManager but still represent objects in the database. Compared to managed entities, detached objects have limited functionality: Many JPA methods, for example, lock , do not accept detached objects. Retrieval by

JPA Attributes Annotations

. The persistence provider ignores transient fields when saving or retrieving the entity.  

JPA Extended API Reference Guide

, criteria queries, and JPQL for data retrieval and manipulation. Describes the metamodel and graph APIs

JPA Named Queries

" that retrieves all Country objects from the database: @NamedQuery ( name ="Country.findAll", query

Literals in JPQL and Criteria Queries

types in Java. Entity type literals enable  selective retrieval by type . In JPQL, an entity type

ObjectDB - JPA Object Database for Java

  Boost your application database performance. Database performance is critical as it is the bottleneck in most applications. ObjectDB is extremely fast and much faster than any other JPA solution. Using a relational database management system (RDBMS) to store and retrieve Java objects

Defining a JPA Entity Class

and retrieve Point objects from the database: package com.objectdb.tutorial; import jakarta

What is ObjectDB?

ObjectDB is an Object Oriented Database Management System (ODBMS). It provides all the standard database management services (storage and retrieval , transactions, lock management, query processing, etc.), but it uses an object oriented model to store and manage data. You can easily store ordinary

JPA Query API

, which retrieves all Country objects from the database, is represented by both q1 and q2 . When you build

Step 4: Add a Servlet Class

is retrieved from the application scope attribute, and then an EntityManager (representing a database ... are retrieved from the database and stored in the request's "guest" attribute. Then the processing

Step 3: Define an EJB Session Bean

: public void persist(Guest guest) { em.persist(guest); } // Retrieves all the guests: public List ... : persist - for storing a new  Guest entity in the database. getAllGuests - for retrieving

Step 3: Define a Spring DAO Component

void persist(Guest guest) { em.persist(guest); } // Retrieves all the guests: public List getAllGuests ... - for storing a new  Guest entity in the database. getAllGuests - for retrieving all the existing 

Step 3: Define a Spring DAO Component

void persist(Guest guest) { em.persist(guest); } // Retrieves all the guests: public List ... - for storing a new  Guest entity in the database. getAllGuests - for retrieving all the existing 

Step 3: Define an EJB Session Bean

); } // Retrieves all the guests: public List getAllGuests() { TypedQuery query = em.createQuery( "SELECT g FROM ... - for retrieving all the existing Guest objects from the database. EJB classes are only supported by

Step 4: Add a Servlet Class

on every http request: The EntityManagerFactory is retrieved from the application scope attribute ... and stored in the database. All the Guest entities are retrieved from the database and stored in

Step 5: Add a JSP Page

that have already signed (which are retrieved from the request's guestDao attribute that is set by

Step 2: Define a JPA Entity Class

 a Main class that stores and retrieves instances of the Point entity class.

Step 2: Define a JPA Entity Class

. The next step is adding a Main class that stores and retrieves instances of the Point entity class.

Step 3: Add a Context Listener Class

( contextInitialized ). Retrieves the EntityManagerFactory from the application scope attribute and closes

Getting Started with JPA and Eclipse

This is the Eclipse version of the Quick Start with JPA tutorial. It demonstrates how to create and run a simple JPA application in Eclipse. The demonstrated application uses JPA to store and retrieve simple Point entities, where each Point has two persistent fields: x and y

Step 5: Add a JSP Page

that have already signed (which are retrieved from the request's "guests" attribute that is set by the servlet in

Step 3: Add a Main Class

In this step we will add a main class to the project to store and retrieve Point objects from the database: Right click the tutorial package in the [Package Explorer] window and select New Class . The package name should be tutorial . Enter Main as the class name (case sensitive). Click Finish

Step 3: Add a Main Class

In this step we will add code to the Main class (that was generated with the project) in order to store Point objects in the database and then retrieve them from the database. Use copy and paste to replace the content of the Main class with the following content: package tutorial; import javax