1 | What kind of servers can support Spring Transaction ? |
2 | In service class UserAdminService, there is a method updateUser().
public interface UserAdminService {
public void updateUser() throws UserInvalidException ;
}
UserInvalidException is a checked exception.
This is how it is defined in applicationContext-Service.xml
<bean id="userAdminService, " parent="txProxyTemplate">
<property name="target">
<bean
class="com.abc.impl.UserAdminServiceImpl"
autowire="byName" />
</property>
<property name="transactionAttributes">
<props>
<prop key="internalLoadTreatment">PROPAGATION_NESTED</prop>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
If UserInvalidException is thrown by method updateUser, will the transaction be rolled back ? |
3 | In service class UserAdminService, there is a method updateUser().
public interface UserAdminService {
public void updateUser() throws UserInvalidException ;
}
UserInvalidException is a checked exception.
This is how it is defined in applicationContextService.xml
<bean id="userAdminService, " parent="txProxyTemplate">
<property name="target">
<bean
class="com.abc.impl.UserAdminServiceImpl"
autowire="byName" />
</property>
<property name="transactionAttributes">
<props>
<prop key="internalLoadTreatment">PROPAGATION_NESTED</prop>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
If UserInvalidException is thrown by method updateUser, will the transaction be rolled back ? |
4 | Spring's transaction behavior can be applied to any class not just service or JDBC classes.
True or False |
5 | In Spring Framework's declarative transaction implementation , is it sufficient to annotate the classes with the @Transactional annotation ? |
6 | The key to the Spring transaction abstraction is the notion of a transaction strategy. A transaction strategy is defined by the org.springframework.transaction.PlatformTransactionManager interface.
The TransactionException that can be thrown by any of the PlatformTransactionManager interface's is what kind of exception ? |
7 | One of the unique features of spring transaction management which is not provided by the EJB is |
8 | If for a method updateUser , we do not want the rollback for UserNotFoundException , what changes are to be done in the file configuration below ?
<tx:advice id="txAdvice">
<tx:attributes>
<tx:method name="updateUser"/>
<tx:method name="*"/>
</tx:attributes>
</tx:advice> |
9 | Spring recommends that you only annotate concrete classes (and methods of concrete classes) with the @Transactional annotation, as opposed to annotating interfaces.
True or False. |
10 | In code example below , which transactional advice will take precedence ?
@Transactional(readOnly = true)
public class DefaultFooService implements FooService {
public Foo getFoo(String fooName) {
// do something
}
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
public void updateFoo(Foo foo) {
// do something
}
} |