本文整理了Java中org.hibernate.Transaction.setRollbackOnly()
方法的一些代码示例,展示了Transaction.setRollbackOnly()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transaction.setRollbackOnly()
方法的具体详情如下:
包路径:org.hibernate.Transaction
类名称:Transaction
方法名:setRollbackOnly
暂无
代码示例来源:origin: hibernate/hibernate-orm
/**
* Make a best effort to mark the underlying transaction for rollback only.
*/
default void markRollbackOnly() {
setRollbackOnly();
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testMapsIdJoinColumnOneToOneSelectException() {
setupTest( PersonMapsIdColumnSelectException.class, 1L, true );
doInHibernate(
this::sessionFactory, session -> {
Person pCheck = session.find( PersonMapsIdColumnSelectException.class, 1L );
assertNotNull( pCheck );
assertFalse( Hibernate.isInitialized( pCheck.getCity() ) );
try {
Hibernate.initialize( pCheck.getCity() );
fail( "Should have thrown ObjectNotFoundException" );
}
catch (ObjectNotFoundException expected) {
session.getTransaction().setRollbackOnly();
}
}
);
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testMapsIdOneToOneSelectException() {
setupTest( PersonMapsIdSelectException.class, 1L, true );
doInHibernate(
this::sessionFactory, session -> {
Person pCheck = session.find( PersonMapsIdSelectException.class, 1L );
assertNotNull( pCheck );
assertFalse( Hibernate.isInitialized( pCheck.getCity() ) );
try {
Hibernate.initialize( pCheck.getCity() );
fail( "Should have thrown ObjectNotFoundException" );
}
catch (ObjectNotFoundException expected) {
session.getTransaction().setRollbackOnly();
}
}
);
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testMapsIdJoinColumnOneToOneSelectException() {
setupTest( PersonMapsIdColumnSelectException.class, 1L, true );
doInHibernate(
this::sessionFactory, session -> {
Person pCheck = session.find( PersonMapsIdColumnSelectException.class, 1L );
assertNotNull( pCheck );
assertFalse( Hibernate.isInitialized( pCheck.getCity() ) );
try {
Hibernate.initialize( pCheck.getCity() );
fail( "Should have thrown ObjectNotFoundException" );
}
catch (ObjectNotFoundException expected) {
session.getTransaction().setRollbackOnly();
}
}
);
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testManyToOneSelectException() {
setupTest( PersonManyToOneSelectException.class, 1L, false );
doInHibernate(
this::sessionFactory, session -> {
Person pCheck = session.find( PersonManyToOneSelectException.class, 1L );
assertNotNull( pCheck );
assertFalse( Hibernate.isInitialized( pCheck.getCity() ) );
try {
Hibernate.initialize( pCheck.getCity() );
fail( "Should have thrown ObjectNotFoundException" );
}
catch (ObjectNotFoundException expected) {
session.getTransaction().setRollbackOnly();
}
}
);
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testMapsIdOneToOneSelectException() {
setupTest( PersonMapsIdSelectException.class, 1L, true );
doInHibernate(
this::sessionFactory, session -> {
Person pCheck = session.find( PersonMapsIdSelectException.class, 1L );
assertNotNull( pCheck );
assertFalse( Hibernate.isInitialized( pCheck.getCity() ) );
try {
Hibernate.initialize( pCheck.getCity() );
fail( "Should have thrown ObjectNotFoundException" );
}
catch (ObjectNotFoundException expected) {
session.getTransaction().setRollbackOnly();
}
}
);
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testOneToOneSelectException() {
setupTest( PersonOneToOneSelectException.class, 1L, false );
doInHibernate(
this::sessionFactory, session -> {
Person pCheck = session.find( PersonOneToOneSelectException.class, 1L );
assertNotNull( pCheck );
assertFalse( Hibernate.isInitialized( pCheck.getCity() ) );
try {
Hibernate.initialize( pCheck.getCity() );
fail( "Should have thrown ObjectNotFoundException" );
}
catch (ObjectNotFoundException expected) {
session.getTransaction().setRollbackOnly();
}
}
);
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testOneToOneSelectException() {
setupTest( PersonOneToOneSelectException.class, 1L, false );
doInHibernate(
this::sessionFactory, session -> {
Person pCheck = session.find( PersonOneToOneSelectException.class, 1L );
assertNotNull( pCheck );
assertFalse( Hibernate.isInitialized( pCheck.getCity() ) );
try {
Hibernate.initialize( pCheck.getCity() );
fail( "Should have thrown ObjectNotFoundException" );
}
catch (ObjectNotFoundException expected) {
session.getTransaction().setRollbackOnly();
}
}
);
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testManyToOneSelectException() {
setupTest( PersonManyToOneSelectException.class, 1L, false );
doInHibernate(
this::sessionFactory, session -> {
Person pCheck = session.find( PersonManyToOneSelectException.class, 1L );
assertNotNull( pCheck );
assertFalse( Hibernate.isInitialized( pCheck.getCity() ) );
try {
Hibernate.initialize( pCheck.getCity() );
fail( "Should have thrown ObjectNotFoundException" );
}
catch (ObjectNotFoundException expected) {
session.getTransaction().setRollbackOnly();
}
}
);
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testPkjcOneToOneSelectException() {
setupTest( PersonPkjcSelectException.class, 1L, false );
doInHibernate(
this::sessionFactory, session -> {
Person pCheck = session.find( PersonPkjcSelectException.class, 1L );
assertNotNull( pCheck );
assertFalse( Hibernate.isInitialized( pCheck.getCity() ) );
try {
Hibernate.initialize( pCheck.getCity() );
fail( "Should have thrown ObjectNotFoundException" );
}
catch (ObjectNotFoundException expected) {
session.getTransaction().setRollbackOnly();
}
}
);
}
代码示例来源:origin: hibernate/hibernate-orm
assertTrue( transaction.isActive() );
transaction.setRollbackOnly();
assertTrue( transaction.isActive() );
assertTrue( transaction.getRollbackOnly() );
assertTrue( transaction.isActive() );
transaction.setRollbackOnly();
assertTrue( transaction.isActive() );
assertTrue( transaction.getRollbackOnly() );
代码示例来源:origin: hibernate/hibernate-orm
assertFalse( transaction.isActive() );
try {
transaction.setRollbackOnly();
fail( "Expecting failure #setRollbackOnly on non-active txn" );
代码示例来源:origin: org.hibernate.orm/hibernate-core
/**
* Make a best effort to mark the underlying transaction for rollback only.
*/
default void markRollbackOnly() {
setRollbackOnly();
}
代码示例来源:origin: com.atlassian.hibernate/hibernate.adapter
@Override
public void setRollbackOnly() {
transaction.setRollbackOnly();
}
内容来源于网络,如有侵权,请联系作者删除!