org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager Java Examples
The following examples show how to use
org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocalContainerEntityManagerFactoryBean.java From spring-analysis-note with MIT License | 6 votes |
@Override public void afterPropertiesSet() throws PersistenceException { PersistenceUnitManager managerToUse = this.persistenceUnitManager; if (this.persistenceUnitManager == null) { this.internalPersistenceUnitManager.afterPropertiesSet(); managerToUse = this.internalPersistenceUnitManager; } this.persistenceUnitInfo = determinePersistenceUnitInfo(managerToUse); JpaVendorAdapter jpaVendorAdapter = getJpaVendorAdapter(); if (jpaVendorAdapter != null && this.persistenceUnitInfo instanceof SmartPersistenceUnitInfo) { String rootPackage = jpaVendorAdapter.getPersistenceProviderRootPackage(); if (rootPackage != null) { ((SmartPersistenceUnitInfo) this.persistenceUnitInfo).setPersistenceProviderPackageName(rootPackage); } } super.afterPropertiesSet(); }
Example #2
Source File: LocalContainerEntityManagerFactoryBean.java From java-technology-stack with MIT License | 6 votes |
@Override public void afterPropertiesSet() throws PersistenceException { PersistenceUnitManager managerToUse = this.persistenceUnitManager; if (this.persistenceUnitManager == null) { this.internalPersistenceUnitManager.afterPropertiesSet(); managerToUse = this.internalPersistenceUnitManager; } this.persistenceUnitInfo = determinePersistenceUnitInfo(managerToUse); JpaVendorAdapter jpaVendorAdapter = getJpaVendorAdapter(); if (jpaVendorAdapter != null && this.persistenceUnitInfo instanceof SmartPersistenceUnitInfo) { String rootPackage = jpaVendorAdapter.getPersistenceProviderRootPackage(); if (rootPackage != null) { ((SmartPersistenceUnitInfo) this.persistenceUnitInfo).setPersistenceProviderPackageName(rootPackage); } } super.afterPropertiesSet(); }
Example #3
Source File: LocJpaConfiguration.java From loc-framework with MIT License | 5 votes |
@Bean public EntityManagerFactoryBuilder entityManagerFactoryBuilder( JpaVendorAdapter jpaVendorAdapter, ObjectProvider<PersistenceUnitManager> persistenceUnitManager) { return new EntityManagerFactoryBuilder( jpaVendorAdapter, jpaProperties.getProperties(), persistenceUnitManager.getIfAvailable()); }
Example #4
Source File: LocalContainerEntityManagerFactoryBean.java From spring-analysis-note with MIT License | 3 votes |
/** * Determine the PersistenceUnitInfo to use for the EntityManagerFactory * created by this bean. * <p>The default implementation reads in all persistence unit infos from * {@code persistence.xml}, as defined in the JPA specification. * If no entity manager name was specified, it takes the first info in the * array as returned by the reader. Otherwise, it checks for a matching name. * @param persistenceUnitManager the PersistenceUnitManager to obtain from * @return the chosen PersistenceUnitInfo */ protected PersistenceUnitInfo determinePersistenceUnitInfo(PersistenceUnitManager persistenceUnitManager) { if (getPersistenceUnitName() != null) { return persistenceUnitManager.obtainPersistenceUnitInfo(getPersistenceUnitName()); } else { return persistenceUnitManager.obtainDefaultPersistenceUnitInfo(); } }
Example #5
Source File: LocalContainerEntityManagerFactoryBean.java From java-technology-stack with MIT License | 3 votes |
/** * Determine the PersistenceUnitInfo to use for the EntityManagerFactory * created by this bean. * <p>The default implementation reads in all persistence unit infos from * {@code persistence.xml}, as defined in the JPA specification. * If no entity manager name was specified, it takes the first info in the * array as returned by the reader. Otherwise, it checks for a matching name. * @param persistenceUnitManager the PersistenceUnitManager to obtain from * @return the chosen PersistenceUnitInfo */ protected PersistenceUnitInfo determinePersistenceUnitInfo(PersistenceUnitManager persistenceUnitManager) { if (getPersistenceUnitName() != null) { return persistenceUnitManager.obtainPersistenceUnitInfo(getPersistenceUnitName()); } else { return persistenceUnitManager.obtainDefaultPersistenceUnitInfo(); } }
Example #6
Source File: LocalContainerEntityManagerFactoryBean.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Determine the PersistenceUnitInfo to use for the EntityManagerFactory * created by this bean. * <p>The default implementation reads in all persistence unit infos from * {@code persistence.xml}, as defined in the JPA specification. * If no entity manager name was specified, it takes the first info in the * array as returned by the reader. Otherwise, it checks for a matching name. * @param persistenceUnitManager the PersistenceUnitManager to obtain from * @return the chosen PersistenceUnitInfo */ protected PersistenceUnitInfo determinePersistenceUnitInfo(PersistenceUnitManager persistenceUnitManager) { if (getPersistenceUnitName() != null) { return persistenceUnitManager.obtainPersistenceUnitInfo(getPersistenceUnitName()); } else { return persistenceUnitManager.obtainDefaultPersistenceUnitInfo(); } }
Example #7
Source File: LocalContainerEntityManagerFactoryBean.java From spring4-understanding with Apache License 2.0 | 3 votes |
/** * Determine the PersistenceUnitInfo to use for the EntityManagerFactory * created by this bean. * <p>The default implementation reads in all persistence unit infos from * {@code persistence.xml}, as defined in the JPA specification. * If no entity manager name was specified, it takes the first info in the * array as returned by the reader. Otherwise, it checks for a matching name. * @param persistenceUnitManager the PersistenceUnitManager to obtain from * @return the chosen PersistenceUnitInfo */ protected PersistenceUnitInfo determinePersistenceUnitInfo(PersistenceUnitManager persistenceUnitManager) { if (getPersistenceUnitName() != null) { return persistenceUnitManager.obtainPersistenceUnitInfo(getPersistenceUnitName()); } else { return persistenceUnitManager.obtainDefaultPersistenceUnitInfo(); } }
Example #8
Source File: LocalContainerEntityManagerFactoryBean.java From spring-analysis-note with MIT License | 2 votes |
/** * Set the PersistenceUnitManager to use for obtaining the JPA persistence unit * that this FactoryBean is supposed to build an EntityManagerFactory for. * <p>The default is to rely on the local settings specified on this FactoryBean, * such as "persistenceXmlLocation", "dataSource" and "loadTimeWeaver". * <p>For reuse of existing persistence unit configuration or more advanced forms * of custom persistence unit handling, consider defining a separate * PersistenceUnitManager bean (typically a DefaultPersistenceUnitManager instance) * and linking it in here. {@code persistence.xml} location, DataSource * configuration and LoadTimeWeaver will be defined on that separate * DefaultPersistenceUnitManager bean in such a scenario. * @see #setPersistenceXmlLocation * @see #setDataSource * @see #setLoadTimeWeaver * @see org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager */ public void setPersistenceUnitManager(PersistenceUnitManager persistenceUnitManager) { this.persistenceUnitManager = persistenceUnitManager; }
Example #9
Source File: LocalContainerEntityManagerFactoryBean.java From java-technology-stack with MIT License | 2 votes |
/** * Set the PersistenceUnitManager to use for obtaining the JPA persistence unit * that this FactoryBean is supposed to build an EntityManagerFactory for. * <p>The default is to rely on the local settings specified on this FactoryBean, * such as "persistenceXmlLocation", "dataSource" and "loadTimeWeaver". * <p>For reuse of existing persistence unit configuration or more advanced forms * of custom persistence unit handling, consider defining a separate * PersistenceUnitManager bean (typically a DefaultPersistenceUnitManager instance) * and linking it in here. {@code persistence.xml} location, DataSource * configuration and LoadTimeWeaver will be defined on that separate * DefaultPersistenceUnitManager bean in such a scenario. * @see #setPersistenceXmlLocation * @see #setDataSource * @see #setLoadTimeWeaver * @see org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager */ public void setPersistenceUnitManager(PersistenceUnitManager persistenceUnitManager) { this.persistenceUnitManager = persistenceUnitManager; }
Example #10
Source File: LocalContainerEntityManagerFactoryBean.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Set the PersistenceUnitManager to use for obtaining the JPA persistence unit * that this FactoryBean is supposed to build an EntityManagerFactory for. * <p>The default is to rely on the local settings specified on this FactoryBean, * such as "persistenceXmlLocation", "dataSource" and "loadTimeWeaver". * <p>For reuse of existing persistence unit configuration or more advanced forms * of custom persistence unit handling, consider defining a separate * PersistenceUnitManager bean (typically a DefaultPersistenceUnitManager instance) * and linking it in here. {@code persistence.xml} location, DataSource * configuration and LoadTimeWeaver will be defined on that separate * DefaultPersistenceUnitManager bean in such a scenario. * @see #setPersistenceXmlLocation * @see #setDataSource * @see #setLoadTimeWeaver * @see org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager */ public void setPersistenceUnitManager(PersistenceUnitManager persistenceUnitManager) { this.persistenceUnitManager = persistenceUnitManager; }
Example #11
Source File: LocalContainerEntityManagerFactoryBean.java From spring4-understanding with Apache License 2.0 | 2 votes |
/** * Set the PersistenceUnitManager to use for obtaining the JPA persistence unit * that this FactoryBean is supposed to build an EntityManagerFactory for. * <p>The default is to rely on the local settings specified on this FactoryBean, * such as "persistenceXmlLocation", "dataSource" and "loadTimeWeaver". * <p>For reuse of existing persistence unit configuration or more advanced forms * of custom persistence unit handling, consider defining a separate * PersistenceUnitManager bean (typically a DefaultPersistenceUnitManager instance) * and linking it in here. {@code persistence.xml} location, DataSource * configuration and LoadTimeWeaver will be defined on that separate * DefaultPersistenceUnitManager bean in such a scenario. * @see #setPersistenceXmlLocation * @see #setDataSource * @see #setLoadTimeWeaver * @see org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager */ public void setPersistenceUnitManager(PersistenceUnitManager persistenceUnitManager) { this.persistenceUnitManager = persistenceUnitManager; }
Example #12
Source File: KradEntityManagerFactoryBean.java From rice with Educational Community License v2.0 | 2 votes |
/** * Creates a JPA-specific entity manager factory bean. * * @param manager the persistence unit manager to use. * @return a JPA-specific entity manager factory bean. */ protected LocalContainerEntityManagerFactoryBean createInternalFactoryBean(PersistenceUnitManager manager) { LocalContainerEntityManagerFactoryBean delegate = new LocalContainerEntityManagerFactoryBean(); delegate.setPersistenceUnitManager(manager); return delegate; }