Java Code Examples for javax.persistence.spi.PersistenceUnitTransactionType#RESOURCE_LOCAL
The following examples show how to use
javax.persistence.spi.PersistenceUnitTransactionType#RESOURCE_LOCAL .
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: PersistenceUnitTransactionTypeHelper.java From lams with GNU General Public License v2.0 | 6 votes |
public static PersistenceUnitTransactionType interpretTransactionType(Object value) { if ( value == null ) { return null; } if ( PersistenceUnitTransactionType.class.isInstance( value ) ) { return (PersistenceUnitTransactionType) value; } final String stringValue = value.toString(); if ( StringHelper.isEmpty( stringValue ) ) { return null; } else if ( stringValue.equalsIgnoreCase( "JTA" ) ) { return PersistenceUnitTransactionType.JTA; } else if ( stringValue.equalsIgnoreCase( "RESOURCE_LOCAL" ) ) { return PersistenceUnitTransactionType.RESOURCE_LOCAL; } else { throw new PersistenceException( "Unknown TransactionType: " + stringValue ); } }
Example 2
Source File: EntityManagerFactoryBuilderImpl.java From lams with GNU General Public License v2.0 | 6 votes |
private void applyTransactionProperties(StandardServiceRegistryBuilder ssrBuilder) { PersistenceUnitTransactionType txnType = PersistenceUnitTransactionTypeHelper.interpretTransactionType( configurationValues.get( JPA_TRANSACTION_TYPE ) ); if ( txnType == null ) { txnType = persistenceUnit.getTransactionType(); } if ( txnType == null ) { // is it more appropriate to have this be based on bootstrap entry point (EE vs SE)? txnType = PersistenceUnitTransactionType.RESOURCE_LOCAL; } boolean hasTxStrategy = configurationValues.containsKey( TRANSACTION_COORDINATOR_STRATEGY ); if ( hasTxStrategy ) { LOG.overridingTransactionStrategyDangerous( TRANSACTION_COORDINATOR_STRATEGY ); } else { if ( txnType == PersistenceUnitTransactionType.JTA ) { ssrBuilder.applySetting( TRANSACTION_COORDINATOR_STRATEGY, JtaTransactionCoordinatorBuilderImpl.class ); } else if ( txnType == PersistenceUnitTransactionType.RESOURCE_LOCAL ) { ssrBuilder.applySetting( TRANSACTION_COORDINATOR_STRATEGY, JdbcResourceLocalTransactionCoordinatorBuilderImpl.class ); } } }
Example 3
Source File: JpaTest.java From tomee with Apache License 2.0 | 6 votes |
public void testResourceLocal() throws Exception { transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL; entityManagerFactory = createEntityManagerFactory(); final Object jpaTestObject = getClass().getClassLoader().loadClass("org.apache.openejb.core.cmp.jpa.JpaTestObject").newInstance(); set(jpaTestObject, "EntityManagerFactory", EntityManagerFactory.class, entityManagerFactory); set(jpaTestObject, "NonJtaDs", DataSource.class, nonJtaDs); Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); invoke(jpaTestObject, "setUp"); try { invoke(jpaTestObject, "jpaLifecycle"); } finally { invoke(jpaTestObject, "tearDown"); } }
Example 4
Source File: MutablePersistenceUnitInfo.java From spring-analysis-note with MIT License | 5 votes |
@Override public PersistenceUnitTransactionType getTransactionType() { if (this.transactionType != null) { return this.transactionType; } else { return (this.jtaDataSource != null ? PersistenceUnitTransactionType.JTA : PersistenceUnitTransactionType.RESOURCE_LOCAL); } }
Example 5
Source File: MutablePersistenceUnitInfo.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public PersistenceUnitTransactionType getTransactionType() { if (this.transactionType != null) { return this.transactionType; } else { return (this.jtaDataSource != null ? PersistenceUnitTransactionType.JTA : PersistenceUnitTransactionType.RESOURCE_LOCAL); } }
Example 6
Source File: PersistenceXmlParser.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Find all persistence-units from all accessible {@code META-INF/persistence.xml} resources * * @param integration The Map of integration settings * * @return List of descriptors for all discovered persistence-units. */ public static List<ParsedPersistenceXmlDescriptor> locatePersistenceUnits(Map integration) { final PersistenceXmlParser parser = new PersistenceXmlParser( ClassLoaderServiceImpl.fromConfigSettings( integration ), PersistenceUnitTransactionType.RESOURCE_LOCAL ); parser.doResolve( integration ); return new ArrayList<>( parser.persistenceUnits.values() ); }
Example 7
Source File: MinnalPersistenceUnitInfo.java From minnal with Apache License 2.0 | 4 votes |
public PersistenceUnitTransactionType getTransactionType() { return PersistenceUnitTransactionType.RESOURCE_LOCAL; }
Example 8
Source File: PersistenceUnitInfoBuilder.java From quickperf with Apache License 2.0 | 4 votes |
public PersistenceUnitInfo build(final DataSource dataSource , final Properties config , final Class<?>... persistentClasses) { return new PersistenceUnitInfo(){ @Override public String getPersistenceUnitName() { return "my pu"; } @Override public String getPersistenceProviderClassName() { return "org.hibernate.jpa.HibernatePersistenceProvider"; } @Override public PersistenceUnitTransactionType getTransactionType() { return PersistenceUnitTransactionType.RESOURCE_LOCAL; } @Override public DataSource getJtaDataSource() { return null; } @Override public DataSource getNonJtaDataSource() { return dataSource; } @Override public List<String> getMappingFileNames() { return emptyList(); } @Override public List<URL> getJarFileUrls() { return emptyList(); } @Override public URL getPersistenceUnitRootUrl() { return null; } @Override public List<String> getManagedClassNames() { return Arrays.stream(persistentClasses) .map(c -> c.getName()) .collect(toList()); } @Override public boolean excludeUnlistedClasses() { return false; } @Override public SharedCacheMode getSharedCacheMode() { return SharedCacheMode.NONE; } @Override public ValidationMode getValidationMode() { return ValidationMode.NONE; } @Override public Properties getProperties() { return config; } @Override public String getPersistenceXMLSchemaVersion() { return "2.1"; } @Override public ClassLoader getClassLoader() { return this.getClass().getClassLoader(); } @Override public void addTransformer(ClassTransformer transformer) { } @Override public ClassLoader getNewTempClassLoader() { return null; } }; }
Example 9
Source File: PersistenceUnitInfoImpl.java From high-performance-java-persistence with Apache License 2.0 | 4 votes |
public PersistenceUnitInfoImpl setNonJtaDataSource(DataSource nonJtaDataSource) { this.nonJtaDataSource = nonJtaDataSource; this.jtaDataSource = null; transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL; return this; }
Example 10
Source File: HammockPersistenceUnitInfo.java From hammock with Apache License 2.0 | 4 votes |
@Override public PersistenceUnitTransactionType getTransactionType() { return PersistenceUnitTransactionType.RESOURCE_LOCAL; }
Example 11
Source File: PersistenceUnitInfoImpl.java From hibernate-types with Apache License 2.0 | 4 votes |
public PersistenceUnitInfoImpl setNonJtaDataSource(DataSource nonJtaDataSource) { this.nonJtaDataSource = nonJtaDataSource; this.jtaDataSource = null; transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL; return this; }
Example 12
Source File: PersistenceUnitInfoImpl.java From hibernate-types with Apache License 2.0 | 4 votes |
public PersistenceUnitInfoImpl setNonJtaDataSource(DataSource nonJtaDataSource) { this.nonJtaDataSource = nonJtaDataSource; this.jtaDataSource = null; transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL; return this; }
Example 13
Source File: PersistenceUnitInfoImpl.java From hibernate-types with Apache License 2.0 | 4 votes |
public PersistenceUnitInfoImpl setNonJtaDataSource(DataSource nonJtaDataSource) { this.nonJtaDataSource = nonJtaDataSource; this.jtaDataSource = null; transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL; return this; }
Example 14
Source File: PersistenceUnitInfoImpl.java From hibernate-types with Apache License 2.0 | 4 votes |
public PersistenceUnitInfoImpl setNonJtaDataSource(DataSource nonJtaDataSource) { this.nonJtaDataSource = nonJtaDataSource; this.jtaDataSource = null; transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL; return this; }
Example 15
Source File: DatabaseImpl.java From jweb-cms with GNU Affero General Public License v3.0 | 4 votes |
@Override public PersistenceUnitTransactionType getTransactionType() { return PersistenceUnitTransactionType.RESOURCE_LOCAL; }
Example 16
Source File: PersistenceUnitInfoImpl.java From tutorials with MIT License | 4 votes |
public PersistenceUnitInfoImpl setNonJtaDataSource(DataSource nonJtaDataSource) { this.nonJtaDataSource = nonJtaDataSource; this.jtaDataSource = null; transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL; return this; }
Example 17
Source File: QuarkusPersistenceXmlParser.java From quarkus with Apache License 2.0 | 4 votes |
private QuarkusPersistenceXmlParser() { //N.B. RESOURCE_LOCAL is matching the default in Hibernate ORM; we use the same here as persistence.xml is treated as "legacy" // yet this is not the default that Quarkus will use when booting via `application.properties`. super(FlatClassLoaderService.INSTANCE, PersistenceUnitTransactionType.RESOURCE_LOCAL); }
Example 18
Source File: HibernatePersistenceUnitInfo.java From tutorials with MIT License | 4 votes |
public HibernatePersistenceUnitInfo setNonJtaDataSource(DataSource nonJtaDataSource) { this.nonjtaDataSource = nonJtaDataSource; this.jtaDataSource = null; transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL; return this; }
Example 19
Source File: PersistenceUnitInfoImpl.java From hypersistence-optimizer with Apache License 2.0 | 4 votes |
public PersistenceUnitInfoImpl setNonJtaDataSource(DataSource nonJtaDataSource) { this.nonJtaDataSource = nonJtaDataSource; this.jtaDataSource = null; transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL; return this; }
Example 20
Source File: DynamicEntityUnitInfo.java From we-cmdb with Apache License 2.0 | 4 votes |
public DynamicEntityUnitInfo setNonJtaDataSource(DataSource nonJtaDataSource) { this.nonjtaDataSource = nonJtaDataSource; this.jtaDataSource = null; transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL; return this; }