本文整理汇总了Java中org.jboss.arquillian.transaction.api.annotation.Transactional类的典型用法代码示例。如果您正苦于以下问题:Java Transactional类的具体用法?Java Transactional怎么用?Java Transactional使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Transactional类属于org.jboss.arquillian.transaction.api.annotation包,在下文中一共展示了Transactional类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: shouldUseHibernateOrm52
import org.jboss.arquillian.transaction.api.annotation.Transactional; //导入依赖的package包/类
/**
* Should use hibernate orm 52.
*/
@Test
@Transactional(value=TransactionMode.ROLLBACK)
public void shouldUseHibernateOrm52() {
Session session = entityManager.unwrap( Session.class );
Kryptonite kryptonite1 = new Kryptonite();
kryptonite1.id = 1L;
kryptonite1.description = "Some Kryptonite";
session.persist( kryptonite1 );
session.flush();
session.clear();
// EntityManager methods exposed through Session only as of 5.2
Kryptonite loaded = session.find( Kryptonite.class, 1L );
assertThat( loaded.description, equalTo( "Some Kryptonite" ) );
}
开发者ID:hibernate,项目名称:hibernate-demos,代码行数:22,代码来源:HibernateModulesOnWildflyIT.java
示例2: UnitOfWork_StateUnderTest_ExpectedBehavior1
import org.jboss.arquillian.transaction.api.annotation.Transactional; //导入依赖的package包/类
@Transactional
@Test
public void UnitOfWork_StateUnderTest_ExpectedBehavior1() throws Exception { // TODO should change method name
this.sampleRepository.findAll().stream()
.forEach(this.sampleRepository::remove);
List<Sample> samples = this.sampleRepository.findAll();
assertThat("", samples.size(), equalTo(0));
}
开发者ID:namioka,项目名称:eclipselink-example,代码行数:9,代码来源:SampleRepositoryImplIT.java
示例3: UnitOfWork_StateUnderTest_ExpectedBehavior2
import org.jboss.arquillian.transaction.api.annotation.Transactional; //导入依赖的package包/类
@Transactional
@Test
public void UnitOfWork_StateUnderTest_ExpectedBehavior2() throws Exception { // TODO should change method name
LongStream.range(0L, 10L).boxed()
.map(x -> new Sample(x, String.valueOf(x)))
.forEach(this.sampleRepository::store);
List<Sample> samples = this.sampleRepository.findAll();
assertThat("", samples.size(), equalTo(10));
if (log.isTraceEnabled()) {
samples.stream().forEach(x -> log.trace(x.toString()));
}
}
开发者ID:namioka,项目名称:eclipselink-example,代码行数:13,代码来源:SampleRepositoryImplIT.java
示例4: UnitOfWork_StateUnderTest_ExpectedBehavior3
import org.jboss.arquillian.transaction.api.annotation.Transactional; //导入依赖的package包/类
@Transactional
@Test
public void UnitOfWork_StateUnderTest_ExpectedBehavior3() throws Exception { // TODO should change method name
this.sampleRepository.findAll().stream()
.forEach(this.sampleRepository::remove);
List<Sample> samples = this.sampleRepository.findAll();
assertThat("", samples.size(), equalTo(0));
}
开发者ID:namioka,项目名称:eclipselink-example,代码行数:9,代码来源:SampleRepositoryImplIT.java
示例5: seriouslyYouAlreadyForgotOpenEJB_questionMark
import org.jboss.arquillian.transaction.api.annotation.Transactional; //导入依赖的package包/类
@Test
@Transactional(TransactionMode.COMMIT) // default with persistence extension
@UsingDataSet("datasets/users.yml")
@ShouldMatchDataSet("datasets/expected-users.yml")
public void seriouslyYouAlreadyForgotOpenEJB_questionMark() throws Exception {
assertEquals(2, em.createQuery("select count(e) from User e", Number.class).getSingleResult().intValue());
final User user = em.find(User.class, 2L);
assertNotNull(user);
user.setName("OpenEJB"); // @Transactional(TransactionMode.COMMIT) will commit it and datasets/expected-users.yml will check it
}
开发者ID:apache,项目名称:tomee,代码行数:13,代码来源:PersistenceTest.java
示例6: persist
import org.jboss.arquillian.transaction.api.annotation.Transactional; //导入依赖的package包/类
@Test
@Transactional(TransactionMode.ROLLBACK)
public void persist() {
assertNotNull(em);
// do something with the em
final Person p = new Person();
p.setName("Apache OpenEJB");
em.persist(p);
}
开发者ID:apache,项目名称:tomee,代码行数:11,代码来源:JPATest.java
示例7: testTransactionRequiredForPersist
import org.jboss.arquillian.transaction.api.annotation.Transactional; //导入依赖的package包/类
@Test(expected = TransactionRequiredException.class)
@Transactional(TransactionMode.DISABLED)
public void testTransactionRequiredForPersist() {
em.persist(new Article());
}
开发者ID:thomasfischl,项目名称:fhbay,代码行数:6,代码来源:ArquillianPersistenceTest.java
示例8: noTx
import org.jboss.arquillian.transaction.api.annotation.Transactional; //导入依赖的package包/类
@Test
@Transactional(TransactionMode.DISABLED)
public void noTx() throws SystemException {
assertNull(currentTransaction());
}
开发者ID:apache,项目名称:tomee,代码行数:6,代码来源:TransactionTest.java
示例9: txCommit
import org.jboss.arquillian.transaction.api.annotation.Transactional; //导入依赖的package包/类
@Test
@Transactional(TransactionMode.COMMIT)
public void txCommit() throws SystemException {
assertNotNull(currentTransaction());
}
开发者ID:apache,项目名称:tomee,代码行数:6,代码来源:TransactionTest.java
示例10: txRollback
import org.jboss.arquillian.transaction.api.annotation.Transactional; //导入依赖的package包/类
@Test
@Transactional(TransactionMode.ROLLBACK)
public void txRollback() throws SystemException {
assertNotNull(currentTransaction());
}
开发者ID:apache,项目名称:tomee,代码行数:6,代码来源:TransactionTest.java
示例11: checkTx
import org.jboss.arquillian.transaction.api.annotation.Transactional; //导入依赖的package包/类
@Test
@Transactional
public void checkTx() throws SystemException {
assertNotNull(OpenEJB.getTransactionManager().getTransaction());
}
开发者ID:apache,项目名称:tomee,代码行数:6,代码来源:TxTest.java
注:本文中的org.jboss.arquillian.transaction.api.annotation.Transactional类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论