|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.persistence Interface EntityTransaction
public interface EntityTransaction
EntityTransaction
接口,用于控制本地资源实体管理器的资源事务。getTransaction EntityManager.getTransaction()
方法返回 EntityTransaction
接口。
since |
|
The EntityTransaction
interface is used to control
resource transactions on resource-local entity managers. The
EntityManager.getTransaction()
method returns the EntityTransaction
interface.
- Since:
- Java Persistence 1.0
Method Summary | |
---|---|
void |
begin()
Start the resource transaction. |
void |
commit()
Commit the current transaction, writing any unflushed changes to the database. |
boolean |
getRollbackOnly()
Determine whether the current transaction has been marked for rollback. |
boolean |
isActive()
Indicate whether a transaction is in progress. |
void |
rollback()
Roll back the current transaction |
void |
setRollbackOnly()
Mark the current transaction so that the only possible outcome of the transaction is for the transaction to be rolled back. |
Method Detail |
---|
public void
begin()
开始资源事务。
Throws | IllegalStateException:
如果 #isActive() 为 true。 |
begin
void begin()
- Start the resource transaction.
- Throws:
IllegalStateException
- ifisActive()
is true.
public void
commit()
提交当前事务,将未刷新的更改写入数据库。
Throws | IllegalStateException:
如果 #isActive() 为 false。 |
Throws | RollbackException: 如果提交失败。 |
commit
void commit()
- Commit the current transaction, writing any unflushed
changes to the database.
- Throws:
IllegalStateException
- ifisActive()
is false.RollbackException
- if the commit fails.
public void
rollback()
回滚当前事务
Throws | IllegalStateException:
如果 #isActive() 为 false。 |
Throws | PersistenceException: 如果遇到不可预料的错误情况。 |
rollback
void rollback()
- Roll back the current transaction
- Throws:
IllegalStateException
- ifisActive()
is false.PersistenceException
- if an unexpected error condition is encountered.
public void
setRollbackOnly()
标记当前的事务,使该事务最终只能被回滚。
Throws | IllegalStateException:
如果 #isActive() 为 false。 |
setRollbackOnly
void setRollbackOnly()
- Mark the current transaction so that the only possible
outcome of the transaction is for the transaction to be
rolled back.
- Throws:
IllegalStateException
- ifisActive()
is false.
public boolean
getRollbackOnly()
确定当前事务是否标记为回滚。
Throws | IllegalStateException:
如果 #isActive() 为 false。 |
getRollbackOnly
boolean getRollbackOnly()
- Determine whether the current transaction has been marked
for rollback.
- Throws:
IllegalStateException
- ifisActive()
is false.
public boolean
isActive()
指示事务是否正在进行。
Throws | PersistenceException: 如果遇到不可预料的错误情况。 |
isActive
boolean isActive()
- Indicate whether a transaction is in progress.
- Throws:
PersistenceException
- if an unexpected error condition is encountered.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!