Internal Website Search

1-50 of 200 results

Database Connection using JPA

of an EntityManagerFactory instance is to support instantiation of EntityManager instances. An EntityManagerFactory is constructed for a specific database, and by managing resources efficiently (e.g ... for that database. The instantiation of the EntityManagerFactory itself might be less efficient

javax.persistence.EntityManagerFactory

JPA Interface EntityManagerFactory Interface used to interact with the entity manager factory ... . Once an EntityManagerFactory has been closed, all its entity managers are considered to be in the closed state. Since: JPA 1.0 The Database Connection using JPA article explains how to use EntityManagerFactory . Public

EntityManagerFactory objects being locked during EntityManager creation

wherein the EntityManagerFactory objects are being locked during EntityManager object creation.  Please refer ... to understand any underlying EntityManagerFactory locking mechanism to get deeper insight into ... with ObjectDB wherein the EntityManagerFactory objects are being locked during EntityManager object

Memory Leak in EntityManagerFactory ?

don't understand. 1. the server is running in embedded mode 2. the static EntityManagerFactory (m ... and static EntityManagerFactory Object (i.e. m_manager_factory ) as you can see in the screenshot ... is, that there are 248 com.objectdb.jdo.PMImpl Objects left, and the root gc is as well the EntityManagerFactory

EntityManagerFactory.unwrap(cls) - JPA Method

JPA Method in javax.persistence. EntityManagerFactory T unwrap (   Class  cls ... EntityManagerFactory implementation does not support the specified class, the PersistenceException ... either the underlying EntityManagerFactory implementation class or an interface that it implements. Return

Objectdb EntityManagerFactory problem

gupta Your question is unclear. You can close each EntityManagerFactory by using the close method. By the way, creating an  EntityManagerFactory is relatively slow. It is usually better to use one  EntityManagerFactory per application, with multiple  EntityManager instances for multiple database connections. support Support

EntityManagerFactory Fails To Swtich Over To Slave When Master Is Unavailable

void main(String[] args) {   EntityManagerFactory emf = null;   EntityManager em = null ... to the slave database (10,001) and get results, just before EntityManagerFactory switches ... also noticed, if EntityManagerFactory is created while the master (10,000) is already down, we fail

High memory consumption even after close() of EntityManagerFactory

could not be released. Not even after the EntityManagerFactory closed. We created a small test ... will automatically be released (if the pool is not disabled) on EntityManagerFactory close.   support Support ... ) on EntityManagerFactory close. However, there are other structures that should be released

Closed EntityManagerFactory after upgrading glassfish 3.1.1 to 3.1.2

: Attempt to obtain a connection from a closed EntityManagerFactory at com.objectdb.o ... a connection from a closed EntityManagerFactory at com.objectdb.o.MSG.d(MSG.java:61) at com.objectdb.o.OMF.al

EntityManagerFactory.addNamedEntityGraph(graphName,entityGraph) - JPA Method

JPA Method in javax.persistence. EntityManagerFactory void addNamedEntityGraph (   String graphName,     EntityGraph  entityGraph ) Add a named copy of the EntityGraph to the EntityManagerFactory . If an entity graph with the same name already exists

EntityManagerFactory.close() - JPA Method

JPA Method in javax.persistence. EntityManagerFactory void close () Close the factory, releasing any resources that it holds. After a factory instance has been closed, all methods invoked ... . Once an EntityManagerFactory has been closed, all its entity managers are considered to be in the closed state. Throws

Obtaining a JPA Database Connection

content also require an EntityTransaction instance. Obtaining an EntityManagerFactory Obtaining ... of EntityManagerFactory that represents the relevant database and then we can use that factory instance ... to be able to generate an EntityManagerFactory . But when using ObjectDB you can either define a standard

EntityManagerFactory.isOpen() - JPA Method

JPA Method in javax.persistence. EntityManagerFactory boolean isOpen () Indicates whether the factory is open. Returns true until the factory has been closed. Return: boolean indicating whether the factory is open Since: JPA 1.0

EntityManagerFactory.getMetamodel() - JPA Method

JPA Method in javax.persistence. EntityManagerFactory Metamodel getMetamodel () Return an instance of Metamodel interface for access to the metamodel of the persistence unit. Return: Metamodel instance Throws: IllegalStateException - if the entity manager factory has been closed Since: JPA 2.0

EntityManagerFactory.getCriteriaBuilder() - JPA Method

JPA Method in javax.persistence. EntityManagerFactory CriteriaBuilder getCriteriaBuilder () Return an instance of CriteriaBuilder for the creation of CriteriaQuery objects. Return: CriteriaBuilder instance Throws: IllegalStateException - if the entity manager factory has been closed Since: JPA 2.0

EntityManagerFactory.addNamedQuery(name,query) - JPA Method

JPA Method in javax.persistence. EntityManagerFactory void addNamedQuery (   String name,     Query  query ) Define the query, typed query, or stored procedure query as a named query such that future query objects can be created from it using the createNamedQuery

EntityManagerFactory.getPersistenceUnitUtil() - JPA Method

JPA Method in javax.persistence. EntityManagerFactory PersistenceUnitUtil getPersistenceUnitUtil () Return interface providing access to utility methods for the persistence unit. Return: PersistenceUnitUtil interface Throws: IllegalStateException - if the entity manager factory has been closed Since: JPA 2.0

EntityManagerFactory.getCache() - JPA Method

JPA Method in javax.persistence. EntityManagerFactory Cache getCache () Access the cache that is associated with the entity manager factory (the "second level cache"). Return: instance of the Cache interface or null if no cache is in use Throws: IllegalStateException - if the entity manager factory has been closed Since: JPA 2.0

EntityManagerFactory.getProperties() - JPA Method

JPA Method in javax.persistence. EntityManagerFactory Map getProperties () Get the properties and associated values that are in effect for the entity manager factory. Changing the contents of the map does not change the configuration in effect. Return: properties Throws: IllegalStateException - if the entity manager factory has been closed Since: JPA 2.0

EntityManagerFactory.createEntityManager() - JPA Method

JPA Method in javax.persistence. EntityManagerFactory EntityManager createEntityManager () Create a new application-managed EntityManager . This method returns a new EntityManager instance each time it is invoked. The isOpen method will return true on the returned instance. Return: entity manager

EntityManagerFactory.createEntityManager(synchronizationType,map) - JPA Method

JPA Method in javax.persistence. EntityManagerFactory EntityManager createEntityManager (    SynchronizationType  synchronizationType,    Map map ) Create a new JTA application-managed EntityManager with the specified synchronization type and map of properties

EntityManagerFactory.createEntityManager(synchronizationType) - JPA Method

JPA Method in javax.persistence. EntityManagerFactory EntityManager createEntityManager (    SynchronizationType  synchronizationType ) Create a new JTA application-managed EntityManager with the specified synchronization type. This method returns a new EntityManager instance each

EntityManagerFactory.createEntityManager(map) - JPA Method

JPA Method in javax.persistence. EntityManagerFactory EntityManager createEntityManager (   Map map ) Create a new application-managed EntityManager with the specified Map of properties. This method returns a new EntityManager instance each time it is invoked. The isOpen method

Shared (L2) Entity Cache

objects, which is managed by the EntityManagerFactory and shared by all its EntityManager objects ... ; EntityManager instances.  In addition to the EntityManager 's L1 cache and the EntityManagerFactory 's L2 ... all the EntityManagerFactory and EntityManager instances of the same database - including on different

Database Replication and Clustering

, the master database can be accessed ordinarily as follows: EntityManagerFactory emf ... =a"); A slightly different URL is required in order to access the slave database: EntityManagerFactory emf ... can also be used: EntityManagerFactory emf = Persistence.createEntityManagerFactory( "objectdb

Setting and Tuning of JPA Queries

;        For an EntityManagerFactory - using the  ... .query.timeout", 4000);    EntityManagerFactory emf =       

ObjectDB Object Database Features

competing products . Connection Pooling Automatic connection pool managed by EntityManagerFactory ... (per EntityManager). L2 shared entity data cache  (per EntityManagerFactory ). Database file page cache

JPA Persistence Unit

to instantiate an EntityManagerFactory in JPA (as explained in the JPA Overview section) requires ... ” in the example) identifies the persistence unit when instantiating an EntityManagerFactory

Locking in JPA

;property:             For an EntityManagerFactory ... ; properties.put("javax.persistence.lock.timeout", 2000);    EntityManagerFactory emf =  

JPA Queries

the EntityManagerFactory 's getCriteriaBuilder method or by the  EntityManager 's

Control and Setting

This section contains miscellaneous JPA types. The PersistenceUtil and PersistenceUnitUtil interfaces provide general utility methods: The Cache interface and the CacheRetrieveMode and CacheStoreMode enum types serve in managing the EntityManagerFactory's shared (level 2) cache: Other enum types are provided for setting of various JPA operations:

JPA Metamodel API

Metamodel API is Metamodel . It can be obtained either by the EntityManagerFactory 's getMetamodel

Entity Management Settings

that is managed by the EntityManagerFactory and shared by all its EntityManager instances. The level 2 cache

Posting Sample Code

; EntityManagerFactory emf =             Persistence

JPA Criteria API Queries

the EntityManagerFactory 's getCriteriaBuilder method or by the  EntityManager 's getCriteriaBuilder method

Working with JPA Entity Objects

also manages a level 2 shared cache for the EntityManagerFactory as well as other caches as explained in

JPA Primary Key

); A PersistenceUnitUtil instance is obtained from the EntityManagerFactory . The  getIdentifier method

SSL Configuration

"objectdb" protocol) in the connection URL on the client side: EntityManagerFactory emf = Persistence

Step 3: Add a Context Listener Class

a JPA's EntityManagerFactory instance with a global application scope. We have to register ... created if not existing yet) when the web application starts, by instantiating an EntityManagerFactory ... closing the EntityManagerFactory . To register a ServletContextListener : Open the [New Listener

Step 3: Add a Context Listener Class

a JPA's EntityManagerFactory instance with a global application scope. We have to register ... an EntityManagerFactory . The database will be closed when the web application stops (or when the web server shuts down), by closing the  EntityManagerFactory . To register a ServletContextListener : Open the [New

Step 4: Add a Servlet Class

, IOException { // Obtain a database connection: EntityManagerFactory emf = ( EntityManagerFactory ... ); } } GuestServlet performs the following operations on every http request: The EntityManagerFactory

Step 4: Add a Servlet Class

: EntityManagerFactory emf = ( EntityManagerFactory )getServletContext().getAttribute("emf"); EntityManager em ... on every http request: The EntityManagerFactory is retrieved from the application scope attribute

javax.persistence.Persistence

that is used to obtain an EntityManagerFactory in Java SE environments. It may also be used to cause ... . Public Static Methods EntityManagerFactory createEntityManagerFactory (String persistenceUnitName) Create and return an EntityManagerFactory for the named persistence unit. Parameters

Step 3: Add a Main Class

yet): EntityManagerFactory emf = Persistence.createEntityManagerFactory(       

Step 3: Add a Main Class

a database connection // (create a new database if it doesn't exist yet): EntityManagerFactory emf

Step 2: Define a JPA Entity Class

a context listener class that will manage a JPA's EntityManagerFactory representing the ObjectDB database.

Step 2: Define a JPA Entity Class

listener class that will manage a JPA's EntityManagerFactory representing the ObjectDB database.

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

JPA Static Method in javax.persistence.Persistence EntityManagerFactory createEntityManagerFactory (   String persistenceUnitName,    Map properties ) Create and return an EntityManagerFactory for the named persistence unit using the given properties. Parameters

javax.persistence.EntityManager

an entity Since: JPA 2.1 EntityManagerFactory getEntityManagerFactory () Return the entity manager factory for the entity manager. Return: EntityManagerFactory instance Throws: IllegalStateException

javax.jdo.JDOHelper

, if not found, returns a javax.persistence. EntityManagerFactory cast to a PersistenceManagerFactory ... loader to use to load the {@link PersistenceManagerFactory} or javax.persistence. EntityManagerFactory