当前位置: 首页>>代码示例>>Java>>正文


Java PersistenceUnitTransactionType.RESOURCE_LOCAL属性代码示例

本文整理汇总了Java中javax.persistence.spi.PersistenceUnitTransactionType.RESOURCE_LOCAL属性的典型用法代码示例。如果您正苦于以下问题:Java PersistenceUnitTransactionType.RESOURCE_LOCAL属性的具体用法?Java PersistenceUnitTransactionType.RESOURCE_LOCAL怎么用?Java PersistenceUnitTransactionType.RESOURCE_LOCAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.persistence.spi.PersistenceUnitTransactionType的用法示例。


在下文中一共展示了PersistenceUnitTransactionType.RESOURCE_LOCAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: HSQLDBProvider

public HSQLDBProvider() {
	scan.limitSearchingPathTo(full());
	generator = new RuntimePersistenceGenerator("test", PersistenceUnitTransactionType.RESOURCE_LOCAL, getProvider());
	setProperties(generator);
	
	generateAnnotedClasses();
	for (Class<?> annotatedClass : entities) {
		generator.addAnnotatedClass(annotatedClass);
	}
	
	if (haveSchema()) {
		try {
			executeStatement("CREATE SCHEMA " + schema + " AUTHORIZATION DBA;");
		} catch (Exception e) {
		}
	}
}
 
开发者ID:geraldox100,项目名称:testyourquery,代码行数:17,代码来源:HSQLDBProvider.java

示例2: testResourceLocal

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");
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:16,代码来源:JpaTest.java

示例3: addingService

@SuppressWarnings("unchecked")
@Override
public Object addingService(ServiceReference reference) {
    String unitName = (String)reference.getProperty(JPA_UNIT_NAME);
    if (unitName == null) {
        return null;
    }
    BundleContext puContext = reference.getBundle().getBundleContext();
    TrackedEmf tracked = new TrackedEmf();
    tracked.emf = (EntityManagerFactory)puContext.getService(reference);
    tracked.emSupplier = new EMSupplierImpl(unitName, tracked.emf, coordinator);
    tracked.emSupplierReg = puContext.registerService(EmSupplier.class, tracked.emSupplier,
                                                     getEmSupplierProps(unitName));

    EntityManager emProxy = createProxy(tracked.emSupplier);
    tracked.emProxyReg = puContext.registerService(EntityManager.class, emProxy,
                                                     getEmSupplierProps(unitName));
    
    if (getTransactionType(tracked.emf) == PersistenceUnitTransactionType.RESOURCE_LOCAL) {
        JpaTemplate txManager = new ResourceLocalJpaTemplate(tracked.emSupplier, coordinator);
        tracked.rlTxManagerReg = puContext.registerService(JpaTemplate.class, txManager,
                                                      rlTxManProps(unitName));
    } else {
        tracked.tmTracker = new TMTracker(puContext, tracked.emSupplier, unitName, coordinator);
        tracked.tmTracker.open();
    }
    return tracked;
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:28,代码来源:EMFTracker.java

示例4: getTransactionType

/**
 * 
 * @param emf to get type from
 * @return
 */
private PersistenceUnitTransactionType getTransactionType(EntityManagerFactory emf) {
    try {
        PersistenceUnitTransactionType transactionType = (PersistenceUnitTransactionType) emf.getProperties().get(PersistenceUnitTransactionType.class.getName());
        if (transactionType == PersistenceUnitTransactionType.RESOURCE_LOCAL) {
            return PersistenceUnitTransactionType.RESOURCE_LOCAL;
        }
    } catch (Exception e) {
        LOG.warn("Error while determining the transaction type. Falling back to JTA.", e);
    }
    return PersistenceUnitTransactionType.JTA;
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:16,代码来源:EMFTracker.java

示例5: getTransactionType

@Override
public PersistenceUnitTransactionType getTransactionType() {
	if (this.transactionType != null) {
		return this.transactionType;
	}
	else {
		return (this.jtaDataSource != null ?
				PersistenceUnitTransactionType.JTA : PersistenceUnitTransactionType.RESOURCE_LOCAL);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:MutablePersistenceUnitInfo.java

示例6: getTransactionType

@Override
public PersistenceUnitTransactionType getTransactionType() {
  if (transactionType != null) {
    return transactionType;
  } else {
    return jtaDataSource != null ? PersistenceUnitTransactionType.JTA : PersistenceUnitTransactionType.RESOURCE_LOCAL;
  }
}
 
开发者ID:pflima92,项目名称:vertx-jpa,代码行数:8,代码来源:DefaultPersistenceUnitInfoImpl.java

示例7: getTransactionType

@Override
public PersistenceUnitTransactionType getTransactionType() {
	if (transactionType != null) {
		return transactionType;
	} else {
		return jtaDataSource != null ? PersistenceUnitTransactionType.JTA : PersistenceUnitTransactionType.RESOURCE_LOCAL;
	}
}
 
开发者ID:pflima92,项目名称:jspare-vertx-ms-blueprint,代码行数:8,代码来源:DefaultPersistenceUnitInfoImpl.java

示例8: getTransactionType

@Override
public PersistenceUnitTransactionType getTransactionType() {
    if (persistenceUnitXml.getTransactionType() ==
            org.wisdom.framework.jpa.model.PersistenceUnitTransactionType
                    .RESOURCE_LOCAL) {
        return PersistenceUnitTransactionType.RESOURCE_LOCAL;
    } else {
        return PersistenceUnitTransactionType.JTA;
    }
}
 
开发者ID:wisdom-framework,项目名称:wisdom-jdbc,代码行数:10,代码来源:PersistenceUnitComponent.java

示例9: getTransactionType

public PersistenceUnitTransactionType getTransactionType() {
	if (this.transactionType != null) {
		return this.transactionType;
	}
	else {
		return (this.jtaDataSource != null ?
				PersistenceUnitTransactionType.JTA : PersistenceUnitTransactionType.RESOURCE_LOCAL);
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:9,代码来源:MutablePersistenceUnitInfo.java

示例10: locatePersistenceUnits

@SuppressWarnings({ "deprecation", "rawtypes" })
   public static List<ParsedPersistenceXmlDescriptor> locatePersistenceUnits(
    Map integration, MetaConfig metaConfig) {

final PersistenceXmlParserImpl parser = new PersistenceXmlParserImpl(
	ClassLoaderServiceExt.fromConfigSettings(integration),
	PersistenceUnitTransactionType.RESOURCE_LOCAL);
parser.metaConfig = metaConfig;

return parser.doResolve(integration);
   }
 
开发者ID:levants,项目名称:lightmare,代码行数:11,代码来源:PersistenceXmlParserImpl.java

示例11: parseTransactionType

private static PersistenceUnitTransactionType parseTransactionType(
    String value) {
if (StringHelper.isEmpty(value)) {
    return null;
} else if (value.equalsIgnoreCase("JTA")) {
    return PersistenceUnitTransactionType.JTA;
} else if (value.equalsIgnoreCase("RESOURCE_LOCAL")) {
    return PersistenceUnitTransactionType.RESOURCE_LOCAL;
} else {
    throw new PersistenceException(
	    "Unknown persistence unit transaction type : " + value);
}
   }
 
开发者ID:levants,项目名称:lightmare,代码行数:13,代码来源:PersistenceXmlParserImpl.java

示例12: isResourceLocalInternal

/**
 * @param em
 * @return
 */
private boolean isResourceLocalInternal(EntityManager em) {
    PersistenceUnitTransactionType transactionType = (PersistenceUnitTransactionType)em.getProperties()
        .get(PersistenceUnitTransactionType.class.getName());
    return transactionType == PersistenceUnitTransactionType.RESOURCE_LOCAL;
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:9,代码来源:JpaInterceptor.java

示例13: setNonJtaDataSource

public PersistenceUnitInfoImpl setNonJtaDataSource(DataSource nonJtaDataSource) {
    this.nonJtaDataSource = nonJtaDataSource;
    this.jtaDataSource = null;
    transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL;
    return this;
}
 
开发者ID:vladmihalcea,项目名称:hibernate-types,代码行数:6,代码来源:PersistenceUnitInfoImpl.java

示例14: getTransactionType

@Override
public PersistenceUnitTransactionType getTransactionType() {
    // manage by carbon or developer
    return PersistenceUnitTransactionType.RESOURCE_LOCAL;
}
 
开发者ID:ShotaOd,项目名称:carbon,代码行数:5,代码来源:DefaultPersistenceUnitInfo.java

示例15: start

@Override
public void start() {
    if(null != entityManagerFactory) {
        throw new IllegalStateException("Persistence service was already initialized.");
    }

    final Configuration configuration = new Configuration();

    //
    // We'll want to map these to settings
    //
    configuration.setProperty(AvailableSettings.CURRENT_SESSION_CONTEXT_CLASS, "managed");
    configuration.setProperty(AvailableSettings.USE_GET_GENERATED_KEYS, TRUE_STRING);
    configuration.setProperty(AvailableSettings.USE_REFLECTION_OPTIMIZER, TRUE_STRING);
    configuration.setProperty(AvailableSettings.ORDER_UPDATES, TRUE_STRING);
    configuration.setProperty(AvailableSettings.ORDER_INSERTS, TRUE_STRING);
    configuration.setProperty(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, TRUE_STRING);
    configuration.setProperty("jadira.usertype.autoRegisterUserTypes", TRUE_STRING);
    configuration.setProperty(AvailableSettings.DIALECT, settings.getDatabaseSettings().getDialectClass());

    // turn on and off features based upon log level
    if(LOG.isDebugEnabled()) {
        configuration.setProperty(AvailableSettings.GENERATE_STATISTICS, TRUE_STRING);
        configuration.setProperty(AvailableSettings.SHOW_SQL, TRUE_STRING);
    } else {
        configuration.setProperty(AvailableSettings.GENERATE_STATISTICS, FALSE_STRING);
        configuration.setProperty(AvailableSettings.SHOW_SQL, FALSE_STRING);
    }

    // add in all the entities
    for (final Class<? extends Serializable> entity : settings.getDatabaseSettings().getEntities()) {
        LOG.debug("Adding entity: {}", entity.getCanonicalName());
        configuration.addAnnotatedClass(entity);
    }

    final ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
        .applySettings(configuration.getProperties())
        // set our connection provider
        .addService(ConnectionProvider.class, connectionProvider)
        .build();

    // create the actual entity manager
    this.entityManagerFactory = new EntityManagerFactoryImpl(PersistenceUnitTransactionType.RESOURCE_LOCAL,
                                                             false,
                                                             null,
                                                             configuration,
                                                             serviceRegistry,
                                                             persistenceUnitName);

}
 
开发者ID:Metrink,项目名称:croquet,代码行数:50,代码来源:CroquetPersistService.java


注:本文中的javax.persistence.spi.PersistenceUnitTransactionType.RESOURCE_LOCAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。