锘??xml version="1.0" encoding="utf-8" standalone="yes"?>91嫩草亚洲精品,国产视频一区在线播放,欧美在线精品免播放器视频http://www.aygfsteel.com/SunRiver/category/17335.htmlTopics about Java EE, XML,AJAX,SOA,OSGi,DB, .NET etc.zh-cnTue, 04 Dec 2007 14:45:18 GMTTue, 04 Dec 2007 14:45:18 GMT60Spring Transaction Managementhttp://www.aygfsteel.com/SunRiver/archive/2007/12/01/164500.htmlSun RiverSun RiverSat, 01 Dec 2007 07:20:00 GMThttp://www.aygfsteel.com/SunRiver/archive/2007/12/01/164500.html1. How someone can define that a method should be execute inside read-only transaction semantics?

  A

It is not possible

  B

No special action should be taken, default transaction semantics is read-only

  C

It is possible using the following snippet:
<tx:methodname="some-method"semantics="read-only"/>

D

It is possible using the following snippet:
<tx:methodname="some-method"read-only="true"/>  

explanation

Default semantics in Spring is read/write, and someone should use read-only attribute to define read-only semantics for the method.

2.      What is the correct way to execute some code inside transaction using programmatic transaction management?

 A

Extend TransactionTemplate class and put all the code inside execute() method.

  B

Implement class containing business code inside the method. Inject this class into TransactionManager.

C

Extend TransactionCallback class. Put all the code inside doInTransaction() method. Pass the object of created class as parameter to transactionTemplate.execute() method. 

  D

Extend TransactionCallback class. Put all the code inside doInTransaction() method. Create the instance of TransactionCallback, call transactionCallback.doInTransaction method and pass TransactionManager as a parameter.

3. Select all statements that are correct.

Spring provides a consistent programming model across different transaction APIs such as JTA, JDBC, Hibernate, JPA, and JDO.

The Spring Framework supports declarative transaction management.

Spring provides a simpler API for programmatic transaction management than a number of complex transaction APIs such as JTA.

The transaction management integrates very well with Spring's various data access abstractions.

4. Does this method guarantee that all of its invocations will process data with ISOLATION_SERIALIZABLE?
Assume
txManager to be valid and only existing PlatformTransactionManager .
publicvoid query(){
       DefaultTransactionDefinition txDef =newDefaultTransactionDefinition();
       txDef.setIsolationLevel(TransactionDefinition.ISOLATION_SERIALIZABLE);
       txDef.setReadOnly(true);
       txDef.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
       TransactionStatus txStat = txManager.getTransaction(txDef);
       // ...
       txManager.commit(txStat);
}

explanation

If this method executes within an existing transaction context, it's isolation level will reflect the existing isolation level. For example JDBC does not specify what happens when one tries to change isolation level during existing transaction. PROPAGATION_REQUIRES_NEW will assure that transaction isolation is set to serializable.

5. You would like to implement class with programmatic transaction management.
How can you get TransactionTemplate instance?

It is necessary to implement a certain interface in this class and then use getTransactionTemplate() call.

 

It is possible to declare TransactionTemplate object in configuration file and inject it in this class.

It is possible to declare PlatformTransactionManager object in configuration file, inject the manager in this class and then create TransactionTemplate like
TransactionTemplate transactionTemplate =newTransactionTemplate(platformTransactionManager);

It's possible to inject either PlatformTransactionManager or TransactionTemplate in this class.
Option one is obviously wrong.

6. Check the correct default values for the @Transactional annotation.

PROPAGATION_REQUIRED

The isolation level defaults to the default level of the underlying transaction system.

readOnly="true"

 

Only the Runtime Exceptions will trigger rollback.

The transaction timeout defaults to the default timeout of the underlying transaction system, or none if timeouts are not supported.

7. To make a method transactional in a concrete class it's enough to use @Transactional annotation before the method name (in Java >=5.0).

correct answer

FALSE

explanation

No, @Transactional annotation only marks a method as transactional. To make it transactional it is necessary to include the <tx:annotation-driven/> element in XML configuration file.

8. The JtaTransactionManager allows us to use distributed transactions. (t)

Sun River 2007-12-01 15:20 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 包头市| 会昌县| 浦县| 射洪县| 息烽县| 崇明县| 南川市| 游戏| 张家口市| 林口县| 莱芜市| 仁化县| 聂拉木县| 万山特区| 湾仔区| 琼结县| 凤山县| 岗巴县| 揭西县| 交口县| 博白县| 新巴尔虎右旗| 施秉县| 孝昌县| 克拉玛依市| 道孚县| 上饶市| 环江| 龙州县| 诏安县| 资源县| 和硕县| 建湖县| 武陟县| 凤翔县| 苗栗市| 赞皇县| 沿河| 台湾省| 栾城县| 徐水县|