Question 1. Describe Java Transaction Api (jta)?
Java Transaction API (JTA) specifies general Java interfaces between a transaction supervisor and the parties concerned in a dispensed transaction device: the useful resource manager, the software server, and the transactional packages.
The JTA allows applications to perform distributed transactions, that is, transactions that access and update data on two or more networked laptop resources.
The Java Transaction API consists of 3 elements: a high-degree software transaction demarcation interface, a excessive-stage transaction supervisor interface meant for an application server, and a wellknown Java mapping of the X/Open XA protocol meant for a transactional useful resource supervisor.
Question 2. Define Transaction Demarcation?
Transaction demarcation constantly wraps a sequence of moves, which include a unmarried request, a single approach, or a section of code within a way. The demarcation initializes a few transactional conduct before the demarcated place begins, then ends that transactional conduct while the demarcated vicinity ends. The software server uses these demarcations to determine the appropriate calls to the Transaction Manager object.
Adv Java Interview Questions
Question 3. What Are The Different Types Of Transaction Demarcation?
Declarative Demarcation: When the usage of declarative demarcation, you specify what transaction demarcation modes must be used around certain areas of code. Rather than imposing those demarcations directly on your code, you declare the demarcations in a configuration report or deployment descriptor. The application server is then liable for ensuring that the suitable transactional behavior is used round the required place.
Programmatic Demarcation: At instances, you would possibly need to demarcate transactions in your code. Generally, you must use programmatic demarcation as little as feasible, as it's miles errors-inclined and may intrude with the utility servers very own transaction demarcation mechanisms. If you discover it vital to apply programmatic demarcation, you ought to be very careful to ensure that your code handles any unexpected errors and situations.
Question 4. Explain Bean-controlled Transaction?
When an corporation bean defines the bounds of the transaction it's miles referred as bean-managed transaction. In bean-managed transaction demarcation, the code within the consultation or message-pushed bean explicitly marks the bounds of the transaction.
Although beans with box-managed transactions require less coding, they have got one challenge: When a method is executing, it may be associated with both a single transaction or no transaction at all. If we use bean managed transaction we are accountable for programming transaction good judgment into your application code so that developers are answerable for issuing a 'start' announcement and either a 'devote' or an 'abort' statement.
The benefit of bean controlled transaction is that as a developer you have full manipulate over transactional boundaries. For instance, you may run collection of mini transactions within a bean's method the usage of bean controlled transaction.
Adv Java Tutorial
Question five. Difference Between A Transaction And Distributed Transaction?
A transaction defines a logical unit of labor that either absolutely succeeds or produces no end result in any respect.
A dispensed transaction is simply a transaction that accessed and updated statistics on or more networked resources, and therefore should be coordinated amongst those sources.
J2EE Interview Questions
Question 6. Name Few Components Involved In The Distributed Transaction Processing (dtp)?
and the aid supervisor.
Question 7. Explain Resource Manager In Jta Context?
The resource supervisor is not anything however a relational database management system (RDBMS), consisting of Oracle, SQL Server. The real database management is dealt with through this component.
J2EE Tutorial Core Java Interview Questions
Question eight. What Is Resource Adapter In Jta Context?
The aid adapter is the issue that acts as a communications channel, or request translator, between the "outside world,” the software, and the resource supervisor. A JDBC motive force is an example of aid adapter.
Question 9. Explain The Transactional Attribute Required In Jta?
Required is the default transaction characteristic that guarantees the methods are invoked inside Java Transaction API transaction context. Required makes the transactional context used by the bean. If no longer the brand new context may be created.
Angular JS Interview Questions
Question 10. Explain The Transactional Attribute Required New In Jta?
Required New is used when the specified outcomes of the transactions to be devoted irrespective of the caller's transactions.
Core Java Tutorial
Question eleven. Explain The Transactional Attribute Mandatory?
Use the Mandatory attribute if the organization beans method must use the transaction of the patron.
If the consumer is going for walks inside a transaction and invokes the business enterprise beans method, the approach executes within the customers transaction. If the customer isn't always related to a transaction, the box throws the Transaction Required Exception.
Java Interview Questions
Question 12. What Are The Different Transactional Attributes?
Adv Java Interview Questions
Question thirteen. What Is Java Transaction Service (jts)?
JTS is a specification for enforcing a Java transaction supervisor. A transaction supervisor serves as an intermediary between an application and one or greater transaction-succesful useful resource managers consisting of database servers and messaging systems. The JTA specification encompasses the JTA API specification.
Question 14. What Is X/open Xa Architecture?
In the X/Open XA architecture, a transaction manager or transaction processing display (TP monitor) coordinates the transactions across multiple resources such as databases and message queues. Each useful resource has its very own aid manager. The resource supervisor commonly has its very own API for manipulating the aid, for instance the JDBC API to paintings with relational databases. In addition, the useful resource manager lets in a TP reveal to coordinate a allotted transaction between its very own and different resource managers. Finally, there's the utility which communicates with the TP display to start, devote or rollback the transactions. The application also communicates with the character resources the use of their own API to alter the aid.
Question 15. What Is @transactional Annotation?
The javax.Transaction.Transactional annotation offers the software the capability to manipulate transaction barriers declaratively. This annotation can be implemented to any magnificence that the Java EE specification defines as a managed bean (which includes CDI controlled beans).
Question sixteen. Does The J2ee Platform Support Nested Transactions?
No, the J2EE platform helps only flat transactions.
Question 17. Should I Put A Transactional Attribute On An Asynchronous Action Such As Sending An Email?
No. Simply placing a transactional characteristic on a method may not assist if the resource manager can't use a transactional context.
Maven Interview Questions
Question 18. Can An Entity Bean Use Bean-managed Transaction Demarcation?
No. Entity beans usually use box-controlled transaction demarcation. Session beans can use either container-managed or bean-controlled transaction demarcation, but not on the equal time.
J2EE Interview Questions
Question 19. What Are Transactions In Java Ee Application?
Transactions in Java EE utility are a series of actions that each one must be completed efficaciously, or else the adjustments in each action are subsidized out. If all of the actions are a success then the modifications from all actions are devoted. If any person of the moves is unsuccessful then the changes from all the movements are rolled again.
Question 20. What Is Jta (java Transaction Api) In Java Ee?
Java Transaction API is an API laid out in Java EE that gives applications a preferred way to access transactions independent of any specific implementation. JTA transactions are controlled via Java EE transaction manager. Transaction are started, dedicated or rolled back by using calling corresponding techniques at the User Transaction API.
Java collections framework Interview Questions
Question 21. How Are Transactions Maintained In An Ejb Application?
Transactions in EJB utility are either Container-Managed or Bean-Managed.
Container-Managed Transactions - In Container-Managed transactions the transaction boundaries are set inside the EJB field. Container-controlled transactions may be set for both session beans in addition to message-driven beans.
Bean-Managed Transactions - In Bean-Managed transactions the transaction barriers are set especially inside the bean's code. Bean controlled transactions may be set for consultation beans in addition to message-driven beans. Bean manages transaction can either use JDBC transactions or JTA transactions.
Question 22. What Are Transaction Attributes In Container-controlled Transactions?
Transaction attribute determines the scope of a transaction across beans. For instance, if method () of Bean A starts offevolved a transaction and calls method () of bean b, then does approach () run within the transaction started out with the aid of technique (). This is determined by way of the transaction characteristic set on technique ()
A transaction characteristic may have one of the following values:-
Question 23. What Is 'required' Transaction Attribute That Can Be Defined In Container-controlled Transactions?
If a purchaser has an associated transaction and calls a container-managed bean's technique then the technique executes within the client transaction.
If the consumer isn't always related to a transaction then the box starts offevolved a new transaction earlier than calling the bean's technique.
JUnit Interview Questions
Question 24. What Is 'calls for New' Transaction Attribute That Can Be Defined In Container-managed Transactions?
If a patron has an related transaction and calls a box-controlled bean's approach then the container suspends the consumer’s transaction, begins a new transaction, begins the call to the approach and begins the purchaser’s transaction after technique completes.
If the purchaser is not related to a transaction then the box starts offevolved a new transaction earlier than calling the beans approach.
Core Java Interview Questions
Question 25. What Is 'mandatory' Transaction Attribute That Can Be Defined In Container-controlled Transactions?
If a purchaser has an associated transaction and calls a container-controlled bean's technique then the method executes within the patron transaction.
If a purchaser is not associated with a transaction then the container throws a TransactionRequiredException.
Java 8 Tutorial
Question 26. What Is 'not Supported' Transaction Attribute That Can Be Defined In Container-managed Transactions?
If a patron has an related transaction and calls a box-controlled bean's approach then the container suspends the customer’s transaction, calls the bean's technique, and starts offevolved the consumer’s transaction after method execution completes.
If a client isn't always associated with a transaction, then the container does not begin a brand new transaction earlier than calling the bean's method.
Java 8 Interview Questions
Question 27. What Is 'supports' Transaction Attribute That Can Be Defined In Container-controlled Transactions?
If a purchaser has an related transaction and calls a container-managed bean technique then the method executes in the patron transaction.
If a consumer isn't always related to a transaction, then the box does no longer begin a new transaction before calling the bean's method.
Angular JS Interview Questions
Question 28. What Is The Never Transaction Attribute That Can Be Defined In Container-controlled Transactions?
If a client has an related transaction and calls a field-managed bean's method then the container throws a Remote Exception.
If a customer is not related to a transaction, then the container does now not start a brand new transaction before calling the bean's technique.
Question 29. How Do You Set Transaction Timeouts In Container-managed And Bean-controlled Transactions?
Container-Managed Transaction - In field controlled transactions the transaction timeout is set on the field's administration console.
Bean-Managed Transactions - In Bean-controlled transactions, the transaction timeout is ready by way of calling the setTransactionTimeout () method of the User Transaction interface.
Gradle Interview Questions