Internal Website Search

51-100 of 200 results

CRUD Database Operations with JPA

Given an EntityManager , em , that represents a JPA connection to the object database, we can use it to store, retrieve, update and delete database objects. Storing New Entity Objects The following ... of this manual describes how to use JPA for database operations in more detail.

Chapter 2 - JPA Entity Classes

JPA Entity classes are user defined classes whose instances can be stored in a database. To store data in an ObjectDB database using JPA you have to define entity classes that represent your application data object model. This chapter explains how to define and use entity classes. 

JPA Annotations for Access Modes

Persistence fields can either be accessed by JPA directly (as fields) or indirectly (as properties and get/set methods). JPA 2 provides an annotation and an enum for setting the access mode: More details are provided in chapter 2 of the ObjectDB manual.

JPA Metamodel API

The JPA Metamodel API provides the ability to examine the persistent object model and retrieve details on managed classes and persistent fields and properties, similarly to the ability that Java reflection provides for general Java types. The Metamodel Interface The main interface of the JPA

JPA Annotations for Mapping (ORM)

The following JPA annotations and enums are designated for mapping a JPA object model to a relational database, and are not required by ObjectDB: ObjectDB silently ignores all the above annotations.

JPA Annotations for Classes

JPA defines three types of persistable classes which are set by the following annotations: Chapter 2 of the ObjectDB manual explains these annotations in detail. Entity and mapped super classes ... policy (as explained in chapter 3 ): Another JPA class annotation defines an ID class: ID classes

JPA Exceptions

JPA exceptions are represented by a hierarchy of unchecked exceptions: java.lang.Object java.lang.Throwable java.lang.Exception java.lang.RuntimeException javax.persistence.PersistenceException ... .TransactionRequiredException Exception Class Overview The root of the JPA exception class subtree is: General errors

JPA Annotations for Callback Methods

The following annotations can mark methods as JPA callback methods: The Lifecycle Events section of the ObjectDB Manual explains how to use all these annotations on callback methods and with listener classes.

JPA Lifecycle Events

Callback methods are user defined methods that are attached to entity lifecycle events and are invoked automatically by JPA when these events occur. Internal Callback Methods Internal callback methods are methods that are defined within an entity class. For example, the following entity class

Storing JPA Entity Objects

the ObjectDB configuration or in a JPA portable way, by specifying the cascade-persist XML element in the XML

JPA Annotations for Fields

The way a field of a persistable class is managed by JPA can be set by the following annotations: Additional annotations (and enum) are designated for enum fields: Other additional annotations (and enum) are designated for date and calendar fields: Chapter 2 of the ObjectDB manual explains how to use all the above annotations.

JPA Query Expressions (JPQL / Criteria)

, [NOT] MEMBER [OF] and the [NOT] LIKE operator. Logical operators : AND, OR, NOT. In addition, JPA

JPA Metamodel API Attributes

The following interfaces and enum types represent attributes (persistent fields and properties) in the JPA Metamodel API: See the Metamodel Attribute Interface Hierarchy section for more details and examples.

JPA Metamodel API Types

The following interfaces and enum represent types in the JPA Metamodel API:  See the Metamodel Type Interface Hierarchy section for more details and examples.

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 language and many developers are already familiar with it. The main difference between SQL and JPQL

CRUD Operations with JPA

The following subsections explain how to use JPA for CRUD database operations:

DELETE Queries in JPA/JPQL

the java.lang.Object  class in queries (as an extension to JPA ), so the following query

Core JPA Types

This section contains the most essential JPA types.

Running JPA Queries

after query execution (e.g. by results.get(0) ). To eliminate this routine operation JPA provides

Advanced JPA Topics

This section discusses advanced JPA topics:

JPA Annotations for Relationships

Relationships are persistent fields in persistable classes that reference other entity objects. The four relationship modes are represented by the following annotations: Unlike ORM JPA implementations, ObjectDB does not enforce specifying any of the annotations above. Specifying a relationship

Working with JPA Entity Objects

Entity objects are in-memory instances of entity classes (persistable user defined classes), which can represent physical objects in the database. Managing an ObjectDB Object Database using JPA requires using entity objects for many operations, including storing, retrieving, updating and deleting

JPA Annotations for Value Generation

Reference (JavaDoc) of JPA 2 value generation annotations, including @GeneratedValue, @SequenceGenerator and @TableGenerator.

UPDATE SET Queries in JPA/JPQL

Explains how to apply server side bulk update using a JPA/JPQL query.

Getting Started with JPA - IntelliJ Project

To open and run the  Quick Start with JPA tutorial project in IntelliJ IDEA: Download and extract the project zip file: Getting Started with JPA - Maven Project (3KB) Open the project in IntelliJ IDEA: Select File Open Project... . Select the points-console directory and click Open Project

JPA Web App Tutorial - Eclipse Project

To open and run the  JPA Web Application tutorial project in Eclipse: Download and extract the project zip file: JPA Web App - Maven Project (6KB) Open the Maven project in Eclipse: Select  File Import... Maven Existing Maven Projects and click  Next . Select the 

Step 2: Define a JPA Entity Class

To store objects in an ObjectDB database using JPA we need to define an entity class: Open the [New Java Class] dialog box, e.g. by right clicking the project node (in the [Projects] window ... listener class that will manage a JPA's EntityManagerFactory representing the ObjectDB database.

JPA Web App Tutorial - IntelliJ Project

To open and run the  JPA Web Application tutorial project in IntelliJ IDEA: Download and extract the project zip file: JPA Web App - Maven Project (6KB) Open the project in IntelliJ IDEA: Select File Open Project... . Select the guestbook-web directory and click OK . Define the Server

Getting Started with JPA - Eclipse Project

To open and run the Quick Start with JPA tutorial project in Eclipse: Download and extract the project zip file: Getting Started with JPA - Maven Project (3KB) Open the Maven project in Eclipse: Select File Import... Maven Existing Maven Projects and click Next . Select the points-console

Spring MVC JPA Tutorial - NetBeans Project

To open and run the  Spring MVC JPA tutorial project in NetBeans: Download and extract the project zip file: Spring MVC JPA - Maven Project (8KB) Open the Maven project in NetBeans: Select  File Open Project... . Select the  guestbook-spring directory and click  Open

Step 2: Define a JPA Entity Class

To store objects in an ObjectDB database using JPA we need to define an entity class: Right click on the project in the [Package Explorer] window and select New Class . Enter tutorial as the package name (case sensitive). Enter Point as the class name (case sensitive). Click Finish to create

Step 2: Define a JPA Entity Class

To store objects in an ObjectDB database using JPA we need to define an entity class: Open the [New Java Class] dialog box, e.g. by right clicking the tutorial package node (in the [Projects] window) and selecting New Java Class ... Enter Point as the class name - use exactly that case sensitive

Java EE 6 JPA Tutorial - Eclipse Project

To open and run the Java EE 6 Web Application tutorial project in Eclipse: Download and extract the project zip file: Java EE  JPA Web App - Maven Project (7KB) Open the Maven project in Eclipse: Select  File Import... Maven Existing Maven Projects and click  Next . Select

Java EE 6 JPA Tutorial - NetBeans Project

To open and run the  Java EE 6 Web Application tutorial project in NetBeans: Download and extract the project zip file: Java EE  JPA Web App - Maven Project (7KB) Open the Maven project in NetBeans: Select  File Open Project... . Select the  guestbook-jee6 directory

Java EE 6 JPA Tutorial - IntelliJ Project

To open and run the  Java EE 6 Web Application tutorial project in IntelliJ IDEA: Download and extract the project zip file: Java EE  JPA Web App - Maven Project (7KB) Open the project in IntelliJ IDEA: Select  File Open Project... . Select the  guestbook-jee6

ObjectDB Object Database Features

support of the JPA and JDO APIs. Fundamental features of relational databases (e.g. primary keys ... Database with built in support for  JPA 2 . Java Persistence API ( JPA ) Most features of JPA 2 ... fast - much faster than any other JPA solution. General Highly optimized code (as a result of many

Report Generation with BIRT and JPA

Demonstrates how to use ObjectDB as a data source of the Business Intelligence and Reporting Tools (BIRT), open source report generator.

General JPA Tutorials

All about General JPA Tutorials in Java/JPA database - explanations, examples, references, links and related information.

Web App JPA Tutorials

All about Web App JPA Tutorials in Java/JPA database - explanations, examples, references, links and related information.

ObjectDB 2.9 Developer's Guide

Welcome to ObjectDB for Java/ JPA Developer's Guide. Here you can learn how to develop database applications using ObjectDB and JPA (Java Persistence API). The main purpose of this guide is to make you productive with ObjectDB and JPA in a short time. Guide Structure This manual is divided into

SELECT clause (JPQL / Criteria API)

(); Because the results are managed entity objects they have all the support that JPA provides ... detection , support for delete , etc. Query results are not limited to entity objects. JPA 2 adds ... an alternative to representing compound results by Object arrays, JPA supports using custom result

Is ObjectDB better than competing object databases?

support for the Java Persistence API ( JPA ). It also supports a more recent and advanced version of the Java Data Objects (JDO) API than competing object databases. By using a standard API such as JPA ... relational database by using an ORM  JPA provider such as Hibernate, EclipseLink or Open JPA

Literals in JPQL and Criteria Queries

literals (e.g. 077 , 077L ), a feature that is not currently supported by all JPA implementations. String ... can be used (e.g. "Adam\'s" , "abcd\n1234" ) but this is not supported by all the JPA implementations ... '} Enum Literals JPA 2 adds support for enum literals. Enum literals in JPQL queries use

What's next?

This chapter introduced the basic principles of JPA using ObjectDB. You can go into details by ... this chapter: Getting Started with JPA and Eclipse Tutorial Getting Started with JPA and NetBeans ... / JPA projects simply by modifying this sample program. Reading the Next Chapters

Query.getFirstResult() - JPA Method

JPA Method in javax.persistence.Query int getFirstResult () The position of the first result the query object was set to retrieve. Returns 0 if setFirstResult was not applied to the query object. Return: position of the first result Since: JPA 2.0 The Running JPA Queries article explains how to use getFirstResult .

PessimisticLockException.PessimisticLockException(message,cause,entity) - JPA Constructor

JPA Constructor in javax.persistence.PessimisticLockException PessimisticLockException (   String message,    Throwable cause,    Object entity ... , and entity. Parameters: message - the detail message. cause - the cause. entity - the entity. Since: JPA 2.0

CriteriaQuery.having(restriction) - JPA Method

JPA Method in javax.persistence.criteria.CriteriaQuery CriteriaQuery having (    Expression  restriction ) Specify a restriction over the groups of the query. Replaces the previous ... AbstractQuery method. Parameters: restriction - a simple or compound boolean expression Return: the modified query Since: JPA 2.0

LockTimeoutException.LockTimeoutException(message) - JPA Constructor

JPA Constructor in javax.persistence.LockTimeoutException LockTimeoutException (   String message ) Constructs a new LockTimeoutException exception with the specified detail message. Parameters: message - the detail message. Since: JPA 2.0

EntityManager.createNamedQuery(name,resultClass) - JPA Method

JPA Method in javax.persistence.EntityManager TypedQuery createNamedQuery (   String name,    Class  resultClass ) Create an instance of TypedQuery for executing ... name or if the query string is found to be invalid or if the query result is found to not be assignable to the specified type Since: JPA 2.0

PessimisticLockException.PessimisticLockException(entity) - JPA Constructor

JPA Constructor in javax.persistence.PessimisticLockException PessimisticLockException (   Object entity ) Constructs a new PessimisticLockException exception with the specified entity. Parameters: entity - the entity. Since: JPA 2.0