Internal Website Search

1-50 of 200 results

JPA Persistence Unit

A JPA Persistence Unit is a logical grouping of user defined persistable classes (entity classes, embeddable classes and mapped superclasses) with related settings. Defining a persistence unit is optional when using ObjectDB, but required by JPA. persistence .xml Persistence units are defined in

JPA Persistable Types

The term persistable types refers to data types that can be used for storing data in the database. ObjectDB supports all the JPA persistable types, which are: User defined classes - Entity classes ... can be stored in the database directly. Other persistable types can be embedded in entity classes as fields

What is the Java Persistence API (JPA)?

The Java Persistence API (JPA) is a standard API for accessing databases from within Java ... JDBC. Using plain old Java objects (POJO) to represent persistent data can significantly simplify ... of the Java Persistence API (JPA). By interacting with ObjectDB using standard JPA

Storing JPA Entity Objects

New entity objects can be stored in the database either explicitly by invoking the persist method or implicitly as a result of a cascade operation. Explicit Persist The following code stores ... ", "Joseph", "Wurzelbacher"); em. getTransaction (). begin (); em. persist (employee); em. getTransaction

Step 2: Entity Class and Persistence Unit

) and selecting New Entity Class ... (or New Other... Persistence Entity Class and clicking Next ). Enter ... the [Provider and Database] step just click Finish to generate a default persistence .xml file with a default persistence unit (that will be configured later). If the  Finish button is disabled

Step 2: Entity Class and Persistence Unit

) and selecting  New Entity Class ... (or  New Other... Persistence Entity Class and clicking ... entity class. In the [Provider and Database] step click Finish to generate a default persistence .xml file with a default persistence unit (that will be configured later). If the Finish button is disabled

Step 2: Entity Class and Persistence Unit

.Serializable; import java.sql.Date; import javax. persistence .Entity; import javax. persistence .GeneratedValue; import javax. persistence .Id; @Entity public class Guest implements Serializable { private static final long serialVersionUID = 1L; // Persistent Fields: @Id @GeneratedValue Long id; private

Step 2: Entity Class and Persistence Unit

java.io.Serializable; import java.sql.Date; import javax. persistence .Entity; import javax. persistence .GeneratedValue; import javax. persistence .Id; @Entity public class Guest implements Serializable { private static final long serialVersionUID = 1L; // Persistent Fields: @Id @GeneratedValue Long id

JPA Entity Fields

Fields of persistable user defined classes (entity classes, embeddable classes and mapped superclasses) can be classified into the following five groups: Transient fields Persistent fields Inverse ... , persistent and inverse fields) can be used in both entity classes and embeddable classes . However, the last

Retrieving JPA Entity Objects

The Java Persistence API (JPA) provides various ways to retrieve objects from the database ... of the database. The persistence context serves as a cache of retrieved entity objects. If a requested entity object is not found in the persistence context a new object is constructed and filled

javax.persistence.Persistence.PERSISTENCE_PROVIDER

JPA Static Field in javax. persistence . Persistence PERSISTENCE _PROVIDER This final String is deprecated and should be removed and is only here for TCK backward compatibility Since: JPA 1.0

Shared (L2) Entity Cache

Every EntityManager owns a persistence context , which is a collection of all the entity objects that it manages. The persistence context serves as a first level cache. An attempt to retrieve ... the persistence context, rather than a newly instantiated entity object. The scope of the persistence

JPA Class Enhancer

of compiled classes after compilation. Enhancement is mainly for user-defined persistable classes ... . There is one case, however, where enhancement is required. Non persistable classes that access directly (not through methods) persistent fields of enhanced classes must also be enhanced. It is a good practice

Database Explorer

of bookmarked entity objects. The [Schema] window shows the user defined persistable types (entity and embeddable classes) in the database and their persistent fields and indexes. The [Query] window enables ... a single object, every column represents a persistent field, and the content of a cell is the value

Database Connection using JPA

Working with the Java Persistence API (JPA) consists of using the following interfaces: Overview ... a static factory method of the JPA bootstrap class,  Persistence : EntityManagerFactory emf = Persistence . createEntityManagerFactory ("objectdb:myDbFile.odb"); Another form

javax.persistence.Persistence

JPA Class Persistence java.lang.Object ∟  javax. persistence . Persistence Bootstrap class ... schema generation to occur. The Persistence class is available in a Java EE container environment as ... . The Persistence class is used to obtain a PersistenceUtil instance in both Java EE and Java SE

Working with JPA Entity Objects

Entity objects are in-memory instances of entity classes ( persistable user defined classes ... the database. An entity object becomes Managed when it is persisted to the database via an EntityManager’s persist method, which must be invoked within an active transaction. On transaction commit

javax.persistence.CascadeType.PERSIST

JPA Enum Constant in javax. persistence .CascadeType PERSIST Cascade persist operation Since: JPA 1.0

Entity Management Settings

" ) specifies whether the Enhancer Agent should be loaded to enhance persistable types on the fly ... . The possible values of the reflection attribute represent different policies: "error" - all persistable ... the reference type for holding non dirty entities in the persistence context of the EntityManager

[ODB1] Chapter 3 - Persistent Classes

Persistent Classes are user defined classes whose instances can be stored in a database using JDO. Instances of these classes that represent objects in the database are called persistent objects or persistent instances . Objects that do not represent anything in the database (including instances

Defining a JPA Entity Class

Point objects from the database: package com.objectdb.tutorial; import javax. persistence .Entity; @Entity public class Point { // Persistent Fields: private int x; private int y; // Constructor: Point ... an entity class. An attempt to persist Point objects in the database without marking the Point class

JPA Exceptions

.Throwable java.lang.Exception java.lang.RuntimeException javax. persistence .PersistenceException javax. persistence .EntityExistsException javax. persistence .EntityNotFoundException javax. persistence .LockTimeoutException javax. persistence .NonUniqueResultException javax. persistence .NoResultException

[ODB1] Chapter 6 - Persistent Objects

Objects Persistent In JDO applications, every object in memory is either a persistent object, i.e ... object, regardless of its type. Instances of persistent classes can become persistent later, as ... transient object. Then it becomes persistent by an explicit call to the makePersistent( ... ) method

Setting and Tuning of JPA Queries

supports the following query hints: "javax. persistence .query.timeout" - sets maximum query execution time ... . persistence .lock.timeout" - sets maximum waiting time for pessimistic locks, when pessimistic locking ... ): For the entire persistence unit - using a persistence .xml  property:     

Paths and Types in JPQL and Criteria API

Instances of user defined persistable classes (entity classes, mapped super classes and embeddable ... defined persistable classes can participate in direct comparison using the = and operators ... expression) and uses the dot ( . ) operator to navigate through persistent fields to other objects

javax.persistence.EntityManager

JPA Interface EntityManager Interface used to interact with the persistence context. An EntityManager instance is associated with a persistence context. A persistence context is a set of entity instances in which for any persistent entity identity there is a unique entity instance

Locking in JPA

occurs a LockTimeoutException is thrown immediately. The "javax. persistence .lock.timeout"  hint ... ;The hint can be set in several scopes: For the entire persistence unit - using a persistence .xml   ... ; properties.put("javax. persistence .lock.timeout", 2000);   EntityManagerFactory emf =  

javax.persistence.Query

of entities updated or deleted Throws: IllegalStateException - if called for a Java Persistence query ... - if there is no transaction or the persistence context has not been joined to the transaction QueryTimeoutException ... is found not to be a Java Persistence query language SELECT query or a Criteria API query Since: JPA 2.0

javax.persistence.TypedQuery

: IllegalStateException - if called for a Java Persistence query language SELECT statement or for a criteria query TransactionRequiredException - if there is no transaction or the persistence context has not ... Throws: IllegalStateException - if the query is found not to be a Java Persistence query language

javax.persistence.PersistenceContext

Expresses a dependency on a container-managed EntityManager and its associated persistence context ... for the container or persistence provider. Vendor specific properties may be included in this set ... whether the persistence context is always automatically synchronized with the current transaction or

javax.persistence.FlushModeType

JPA Enum FlushModeType java.lang.Object ∟  java.lang.Enum ∟  javax. persistence ... is set on the Query or javax. persistence .TypedQuery object, or if the flush mode setting for the persistence context is AUTO (the default) and a flush mode setting has not been specified for the Query or

javax.persistence.StoredProcedureQuery

: TransactionRequiredException - if there is no transaction or the persistence context has not ... - if the query is found not to be a Java Persistence query language SELECT query or a Criteria API ... IllegalStateException - if invoked on a native query or Java Persistence query language query when the implementation

javax.persistence.EntityExistsException

.Exception ∟  java.lang.RuntimeException ∟  javax. persistence .PersistenceException ∟  javax. persistence .EntityExistsException Thrown by the persistence provider when EntityManager. persist (Object) is called and the entity already exists. The current transaction, if one is active

javax.persistence.OrderColumn

a column that is used to maintain the persistent order of a list. The persistence provider is responsible for maintaining the order upon retrieval and in the database. The persistence provider ... for ordering that is visible as persistent state and maintained by the application. The OrderBy annotation

javax.persistence.PersistenceUnitUtil

the application and the persistence provider managing the persistence unit. The methods ... for this persistence unit or on new entity instances. Since: JPA 2.0 Public Methods Object getIdentifier ... the load state of an entity belonging to the persistence unit. This method can be used to determine

javax.persistence.EnumType

JPA Enum EnumType java.lang.Object ∟  java.lang.Enum ∟  javax. persistence .EnumType Defines mapping for enumerated types. The constants of this enumerated type specify how a persistent property or field of an enumerated type should be persisted . Since: JPA 1.0 The JPA Persistable Types

javax.persistence.PessimisticLockScope

JPA Enum PessimisticLockScope java.lang.Object ∟  java.lang.Enum ∟  javax. persistence .PessimisticLockScope Defines the values of the javax. persistence .lock.scope property for pessimistic ... will be locked if the javax. persistence .lock.scope property is specified with a value

javax.persistence.NamedQuery

, named query in the Java Persistence query language. Query names are scoped to the persistence unit ... of the definition of a named query in the Java Persistence query language: @NamedQuery( name ... must be executed in a transaction and the persistence context joined to the transaction. Since: JPA 2.0

javax.persistence.SynchronizationType

JPA Enum SynchronizationType java.lang.Object ∟  java.lang.Enum ∟  javax. persistence .SynchronizationType Specifies whether the persistence context is always automatically synchronized with the current transaction or whether the persistence context must be explicitly joined to the current

javax.persistence.PersistenceContextType

JPA Enum PersistenceContextType java.lang.Object ∟  java.lang.Enum ∟  javax. persistence .PersistenceContextType Specifies whether a transaction-scoped or extended persistence context is to be used in PersistenceContext . If not specified, a transaction-scoped persistence context is used

Persistence.createEntityManagerFactory(persistenceUnitName,properties) - JPA Static Method

JPA Static Method in javax. persistence . Persistence EntityManagerFactory createEntityManagerFactory ... and return an EntityManagerFactory for the named persistence unit using the given properties. Parameters: persistenceUnitName the - name of the persistence unit properties Additional - properties to use

Persistence.createEntityManagerFactory(persistenceUnitName) - JPA Static Method

JPA Static Method in javax. persistence . Persistence EntityManagerFactory createEntityManagerFactory ... for the named persistence unit. Parameters: persistenceUnitName the - name of the persistence unit Return: the factory that creates EntityManagers configured according to the specified persistence unit Since: JPA 1.0

javax.persistence.ValidationMode

JPA Enum ValidationMode java.lang.Object ∟  java.lang.Enum ∟  javax. persistence .ValidationMode The validation mode to be used by the provider for the persistence unit. Since: JPA 2.0 Enum Constants AUTO If a Bean Validation provider is present in the environment, the persistence provider

[ODB1] Chapter 4 - JDO Metadata

more persistent classes. All the persistent classes, and only them, have to be declared in a metadata ... at runtime, ObjectDB determines whether or not each class is persistent . It searches for JDO metadata ... is found, the class is persistent , and if not, the class is transient. Metadata for class a.b.X ( a.b

[ODB1] Chapter 2 - A Quick Tour

.getPersistenceManager("hello.odb"); 14 pm.currentTransaction().begin(); 15 16 // Obtain a persistent list: 17 ... } 27 28 // Add a new string to the persistent list: 29 list.add("Hello World " + list.size()); 30 31 // Display the content of the persistent list: 32 Iterator itr = list.iterator(); 33 while (itr

[ODB1] Chapter 9 - ObjectDB Explorer

is open. The "Class" window shows all the persistent classes in the database. You can select a class from the list of classes at the top of this window and see all its persistent fields ... represents a persistent field, and the content of a cell is the value of a single field in a single

[ODB1] Chapter 7 - JDOQL Queries

. An Extent , for instance, can be used to retrieve all the instances of a specified persistent class ... three components: A candidate collection containing persistent objects (usually an Extent ) A candidate class (usually a persistent class) A filter, which is a boolean expression in a Java like syntax The query

[ODB1] Chapter 5 - JDO Connections

is obtained by the PersistenceManager . On every attempt to modify a persistent object, within an active ... the same persistent object at the same time, and conflicts are detected at commit time ... . javax.jdo.option.NontransactionalWrite Indicates whether or not persistent objects (i.e. objects

javax.jdo.annotations.Persistent

JDO Annotation Persistent Target: ElementType.FIELD, ElementType.METHOD Implemented Interfaces: Annotation Annotation for defining the persistence of a member. This corresponds to the xml elements ... instances in which a member is not persistent but in the non-embedded instances the member is persistent

javax.jdo.annotations.Persistent.persistenceModifier

JDO Annotation Attribute in javax.jdo.annotations. Persistent PersistenceModifier ... which a member is not persistent but in the non-embedded instances the member is persistent . Note that it is not portable to specify a member to be not persistent in the non-embedded case and persistent in the embedded usage. Since: JDO 2.1