1.What is JTA?Java Transaction API is a standard between the transaction manager and the entities participated in the distributed transaction system... 2.What is bean managed transaction?A bean managed transaction is an explicitly bounded for a specific transaction that is handled by a bean... 3.What do you mean by demarcation? Explain the types of demarcation?Demarcation and its types - Demarcation specifies a limit for a bean managed transaction... 4.Transactional attributes that the EJB supports?Transactional attributes that the EJB supports - Required: This is the default transaction attribute that ensures the methods are invoked within Java Transaction API transaction context... From Wikipedia, the free encyclopedia 5.What is X/Open XA architecture.?In the X/Open XA architecture, a transaction manager or transaction processing monitor (TP monitor) coordinates the transactions across multiple resources such as databases and message queues. Each resource has its own resource manager. The resource manager typically has its own API for manipulating the resource, for example the JDBC API to work with relational databases. In addition, the resource manager allows a TP monitor to coordinate a distributed transaction between its own and other resource managers. Finally, there is the application which communicates with the TP monitor to begin, commit or rollback the transactions. The application also communicates with the individual resources using their own API to modify the resource. 6.What is JTA implementation of the X/Open XA architecture.?The JTA API consists of classes in two Java packages:
7.What is Java Transaction API.?The Java Transaction API consists of three elements: a high-level application transaction demarcation interface, a high-level transaction manager interface intended for an application server, and a standard Java mapping of the X/Open XA protocol intended for a transactional resource manager. 8.What is UserTransaction interface?The javax.transaction.UserTransaction interface provides the application the ability to control transaction boundaries programmatically. This interface may be used by Java client programs or EJB beans.
The UserTransaction.begin() method starts a global transaction and associates the transaction with the calling thread. The transaction-to-thread association is managed transparently by the Transaction Manager. 9.What is @Transactional annotation.?
The javax.transaction.Transactional annotation provides the application the ability to control transaction boundaries declaratively. This annotation can be applied to any class that the Java EE specification defines as a managed bean (which includes CDI managed beans).
@RequestScoped
public class ExampleBean {
Transactional behavior can be configured via an attribute on the annotation. The available options closely mirror those of the EJB specification.
@Transactional public void foo() { // A transaction is active here // Do work } // After the method returns transaction is committed or rolled back } 10.What is @TransactionScoped annotation.?
The javax.transaction.TransactionScoped annotation provides the application the ability to declare that the scope during which a bean lives is tied to the time a given transaction is active.
@TransactionScoped
If method foo() is first called on a managed instance of ExampleBean and then subsequently method bar() is called, the number printed will be 0 and not 1. This is because each method had its own transaction and therefore its own instance of TxScopedBean. The number 1 that was set during the call to foo() will therefore not be seen during the call tobar().
public class TxScopedBean { public int number; public int getNumber() {return number;} public void setNumber(int number) {this.number = number;} } @RequestScoped public class ExampleBean { @Inject private TxScopedBean tXscopedBean; @Transactional public void foo() { tXscopedBean.setNumber(1); } @Transactional public void bar() { System.out.print(tXscopedBean.getNumber()); } } 11.What is UserTransaction support in EJB server.?
EJB servers are required to support the UserTransaction interface for use by EJB beans with the BEAN value in the javax.ejb.TransactionManagement annotation (this is called bean-managed transactions or BMT). The UserTransaction interface is exposed to EJB components through either the EJBContext interface using the getUserTransaction method, or directly via injection using the general @Resource annotation. Thus, an EJB application does not interface with the Transaction Manager directly for transaction demarcation; instead, the EJB bean relies on the EJB server to provide support for all of its transaction work as defined in the Enterprise JavaBeans Specification. (The underlying interaction between the EJB Server and the TM is transparent to the application; the burden of implementing transaction management is on the EJB container and server provider.[1])
@Stateless
Alternatively, the UserTransaction can be obtained from the SessionContext:
@TransactionManagement(BEAN) public class ExampleBean { @Resource private UserTransaction utx; public void foo() { // start a transaction utx.begin(); // Do work // Commit it utx.commit(); } }
@Stateless
Note though that in the example above if the @TransactionManagement(BEAN) annotation is omitted, a JTA transaction is automatically started whenever foo() is called and is automatically committed or rolled back when foo() is exited. Making use of a UserTransaction is thus not necessary in EJB programming, but might be needed for very specialized code.
@TransactionManagement(BEAN) public class ExampleBean { @Resource private SessionContext ctx; public void foo() { UserTransaction utx = ctx.getUserTransaction(); // start a transaction utx.begin(); // Do work // Commit it utx.commit(); } } 12.What is UserTransaction support in JNDI.?The UserTransaction should be available under java:comp/UserTransaction (if a JTA implementation is installed in the environment). 13.What is Open source JTA implementations.?There exist a number of active (as of September 2010) open source JTA implementations.
Narayana[edit] 14.What is a transaction?A transaction is an abstraction of an atomic and reliable execution sequence. 15.What is a distributed transaction?A distributed transaction bundles multiple operations in which at least two network hosts are involved, for example, an enterprise bean deployed under an Enterprise JavaBean (EJB) server on network host jupiter that has a JDBC connection(s) to a database server on network host saturn. In enterprise computing, it's often the case that several network hosts are involved, each hosting different servers, for example, web servers, EJB servers, Java Message Service (JMS) servers, and other Java or CORBA-based application servers. 16.What is the acronym ACID?ACID represents the four properties of every transaction: 17.What parties are involved in transaction processing?There are five principals: 18.What is the Java Transaction API (JTA)?JTA is a service-oriented API specification. Typically, we think of JTA as the service API used by application programmers to group operations into one or more logical transactions. JTA actually provides three types of services: 19.What is the Java Transaction Service (JTS)?JTS is a specification for implementing a Java transaction manager. A transaction manager serves as an intermediary between an application and one or more transaction-capable resource managers such as database servers and messaging systems. The JTS specification encompasses the JTA API specification. 20.How does a Java applet obtain a transaction object?It shouldn't, no matter how clever the programmer! Applets, by definition, should be (very) thin clients. Transaction-related operations should be minimized even in end-user client applications. The main objective of enterprise computing is to factor distributed applications so that server-intensive operations are handled by server-side application components. |