Bug 324974 - JPA:ER: Add early Login capability via new persistence property flag to EntityManagerFactory (extend validation-only to include login)
Summary: JPA:ER: Add early Login capability via new persistence property flag to Entit...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL: http://wiki.eclipse.org/EclipseLink/D...
Whiteboard:
Keywords:
Depends on: 322585 324213
Blocks:
  Show dependency tree
 
Reported: 2010-09-10 10:35 EDT by Michael OBrien CLA
Modified: 2022-06-09 10:08 EDT (History)
2 users (show)

See Also:
michael.f.obrien: documentation+


Attachments
early EMF predeploy post login preliminary patch (4.77 KB, patch)
2010-09-10 11:06 EDT, Michael OBrien CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael OBrien CLA 2010-09-10 10:35:49 EDT
>This enhancement is requested by PM
>Problem: Users may want to do an early session.login() to the DB on EntityManagerFactory predeploy instead of waiting for the first EntityManager deploy
This functionality when enabled via a "new" persistence.xml property would extend the existing "validation-only" flag to also do a login in addition to presently initializing descriptors.
History: The fix for bug # 322585, bug # 303063 and bug # 297928 introduced an early login only for the emf.getMetamodel() or emf.getCriteriaBuilder() case via an emf.getServerSession() call.
This enhancement would extend this early login by adding a getServerSession() call into the emf.predeploy() directly if this flag was set.

>Forensics and Volumetrics

======Performance Results 106-3======
  The following show that that the time taken to update the session, do DDL generation and intialize the metamodel and canonical metamodel has shifted to the EMF creation from the EM creation.  In essence an '''emf.createEntityManager()''' now takes just a couple microseconds instead of seconds.
  Doing all the following in the predeploy
    updateServerSession
    session.login
    generateDDL
    metamodel initalization
    canonical metamodel initialization
  takes in '''SE'''
    '''with change'''
      predeploy() = 2.6 sec
        [EL Finest]: 2010-08-17 18:01:12.002--ServerSession(27196165)--Thread(Thread[main,5,main])--Begin predeploying Persistence Unit dao.create.tables.derby; session default-session; state Initial; factoryCount 0
        [EL Finest]: 2010-08-17 18:01:14.67--ServerSession(27196165)--Thread(Thread[main,5,main])--End deploying Persistence Unit dao.create.tables.derby; session default-session; state Deployed; factoryCount 1
      deploy() = 0.09 sec 
        [EL Finest]: 2010-08-17 18:01:14.67--ServerSession(27196165)--Thread(Thread[main,5,main])--End deploying Persistence Unit dao.create.tables.derby; session default-session; state Deployed; factoryCount 1
        [EL Finer]:  2010-08-17 18:01:14.763--ServerSession(27196165)--Thread(Thread[main,5,main])--client acquired
    '''without change'''
      predeploy() = 0.75 sec
        [EL Finest]: 2010-08-17 17:58:29.169--ServerSession(2279771)--Thread(Thread[main,5,main])--Begin predeploying Persistence Unit dao.create.tables.derby; session default-session; state Initial; factoryCount 0
        [EL Finest]: 2010-08-17 17:58:29.934--ServerSession(2279771)--Thread(Thread[main,5,main])--End predeploying Persistence Unit dao.create.tables.derby; session default-session; state Predeployed; factoryCount 1
      deploy() = 1.87 sec
        [EL Finest]: 2010-08-17 17:58:29.934--ServerSession(2279771)--Thread(Thread[main,5,main])--Begin deploying Persistence Unit dao.create.tables.derby; session default-session; state Predeployed; factoryCount 1
        [EL Finer]:  2010-08-17 17:58:31.806--ServerSession(2279771)--Thread(Thread[main,5,main])--client acquired

  On emf.createEntityManager() we just skip deploy/login in getServerSession(), login in createEntityManagerImpl as well as deploy/login in getServerSession() in the EntityManagerImpl constructor
  because the emf.createEntityManager() does virtually nothing after this change
    EE Server testing on WebLogic 10.3.3.0 via standard @PersitenceContext injection on a SSB @EJB injected on a servlet client is OK
    Notice that a predeploy also does a deploy now - previously the deploy was only done when the client persisted or read from the persistence unit (via injection)
>stacktrace of change
    Daemon Thread [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] (Suspended (breakpoint at line 314 in EntityManagerSetupImpl))	
	EntityManagerSetupImpl.deploy(ClassLoader, Map) line: 314	
	EntityManagerFactoryImpl.getServerSession() line: 157	
	PersistenceProvider.createContainerEntityManagerFactory(PersistenceUnitInfo, Map) line: 243	
	PersistenceUnitInfoImpl.createEntityManagerFactory(boolean) line: 352	
	PersistenceUnitInfoImpl.createEntityManagerFactory() line: 332	
	PersistenceUnitInfoImpl.<init>(PersistenceUnitBean, PersistenceUnitConfigurationBean, GenericClassLoader, String, URL, URL) line: 134	
	ModulePersistenceUnitRegistry(AbstractPersistenceUnitRegistry).storeDescriptors(Map, Map) line: 336	
	ModulePersistenceUnitRegistry(AbstractPersistenceUnitRegistry).loadPersistenceDescriptor(VirtualJarFile, boolean, File) line: 250	
	ModulePersistenceUnitRegistry.<init>(GenericClassLoader, ApplicationContextInternal, Module, boolean) line: 69	
	EJBModule.setupPersistenceUnitRegistry() line: 221
Comment 1 Michael OBrien CLA 2010-09-10 10:53:35 EDT
>Watch bug # 324213 - we will recommend that the same prerequisites be set for early login as for validation-only
eclipselink.target-database must be set to avoid a sequence validation exception (because DB auto-detection has not yet occurred in an early emf predeploy login
Comment 2 Michael OBrien CLA 2010-09-10 11:06:37 EDT
Created attachment 178618 [details]
early EMF predeploy post login preliminary patch
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:08:29 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink