锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲午夜久久久久久久久电影网,欧美精品一区二区三区蜜桃视频,亚洲女人小视频在线观看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 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 栾城县| 西峡县| 扎囊县| 平舆县| 乌恰县| 军事| 扶余县| 双峰县| 新沂市| 邵武市| 敖汉旗| 汕尾市| 麻城市| 睢宁县| 理塘县| 商水县| 历史| 英超| 永安市| 聂荣县| 广丰县| 新和县| 苏州市| 巨野县| 扶绥县| 青河县| 达尔| 教育| 明星| 阿图什市| 依兰县| 利川市| 开江县| 华阴市| 叙永县| 滨州市| 南安市| 和林格尔县| 孟津县| 吴桥县| 镇坪县|