YouTube Icon

Interview Questions.

Top 29 Java Transaction Management Interview Questions - Jul 26, 2022

fluid

Top 29 Java Transaction Management Interview Questions

Q1. Explain Resource Manager In Jta Context?

The resource supervisor is not anything however a relational database management gadget (RDBMS), which include Oracle, SQL Server. The actual database management is dealt with by using this thing.

Q2. Explain Bean-controlled Traction?

When an agency bean defines the limits of the traction it is referred as bean-controlled traction. In bean-managed traction demarcation, the code in the consultation or message-pushed bean explicitly marks the boundaries of the traction.

Although be with box-controlled tractions require much less coding, they've one challenge: When a way is executing, it may be associated with both a single traction or no traction at all. If we use bean managed traction we are chargeable for programming traction good judgment into your software code so that builders are responsible for issuing a 'start' statement and both a 'commit' or an 'abort' declaration.

The advantage of bean managed traction is that as a developer you have full control over tractional limitations. For instance, you can run collection of mini tractions inside a bean's technique the usage of bean managed traction.

Q3. Explain The Tractional Attribute Required New In Jta?

Required New is used when the desired results of the tractions to be dedicated regardless of the caller's tractions.

Q4. What Is 'required' Traction Attribute That Can Be Defined In Container-managed Tractions?

If a client has an associated traction and calls a field-controlled bean's technique then the technique executes within the customer traction.

If the purchaser isn't related to a traction then the field starts offevolved a new traction earlier than calling the bean's method.

Q5. What Are The Different Tractional Attributes?

Required,

Requires New,

Mandatory,

Not Supported,

Supports,

Never.

Q6. What Is 'requires New' Traction Attribute That Can Be Defined In Container-controlled Tractions?

If a consumer has an related traction and calls a container-controlled bean's method then the container suspends the consumer’s traction, begins a new traction, starts the decision to the approach and begins the patron’s traction after technique completes.

If the customer isn't associated with a traction then the container starts a brand new traction before calling the be technique.

Q7. Define Traction Demarcation?

Traction demarcation constantly wraps a sequence of movements, consisting of a unmarried request, a single method, or a segment of code within a way. The demarcation initializes a few tractional conduct before the demarcated area starts offevolved, then ends that tractional behavior while the demarcated region ends. The software server makes use of these demarcations to decide the proper calls to the Traction Manager object.

Q8. What Are The Different Types Of Traction Demarcation?

Declarative Demarcation: When the usage of declarative demarcation, you specify what traction demarcation modes should be used around certain regions of code. Rather than enforcing these demarcations at once to your code, you claim the demarcations in a configuration file or deployment descriptor. The application server is then answerable for ensuring that the suitable tractional behavior is used round the required place.

Programmatic Demarcation: At times, you would possibly need to demarcate tractions for your code. Generally, you must use programmatic demarcation as low as possible, as it's miles error-prone and might intrude with the utility servers very own traction demarcation mechanisms. If you discover it vital to apply programmatic demarcation, you ought to be very careful to ensure that your code handles any sudden mistakes and situations.

Q9. What Are Tractions In Java Ee Application?

Tractions in Java EE application are a series of movements that all must be finished efficiently, or else the changes in every movement are backed out. If all of the movements are successful then the changes from all moves are committed. If any person of the actions is unsuccessful then the modifications from all of the actions are rolled returned.

Q10. How Are Tractions Maintained In An Ejb Application?

Tractions in EJB software are both Container-Managed or Bean-Managed.

Container-Managed Tractions - In Container-Managed tractions the traction obstacles are set in the EJB container. Container-controlled tractions can be set for each session be in addition to message-driven be.

Bean-Managed Tractions - In Bean-Managed tractions the traction limitations are set in particular inside the bean's code. Bean controlled tractions can be set for consultation be in addition to message-driven be. Bean manages traction can both use JDBC tractions or JTA tractions.

Q11. Describe Java Traction Api (jta)?

Java Traction API (JTA) specifies general Java interfaces among a traction supervisor and the events worried in a allotted traction device: the useful resource supervisor, the application server, and the tractional packages.

The JTA allows packages to perform dispensed tractions, this is, tractions that get admission to and update statistics on two or extra networked pc sources.

The Java Traction API includes three elements: a high-stage application traction demarcation interface, a excessive-level traction supervisor interface meant for an software server, and a standard Java mapping of the X/Open XA protocol supposed for a tractional useful resource supervisor.

Q12. What Is Jta (java Traction Api) In Java Ee?

Java Traction API is an API laid out in Java EE that offers packages a preferred way to get entry to tractions impartial of any specific implementation. JTA tractions are controlled by Java EE traction manager. Traction are started out, dedicated or rolled again via calling corresponding techniques at the User Traction API.

Q13. What Is 'not Supported' Traction Attribute That Can Be Defined In Container-controlled Tractions?

If a client has an associated traction and calls a box-managed bean's method then the box suspends the consumer’s traction, calls the bean's approach, and begins the purchaser’s traction after method execution completes.

If a consumer isn't associated with a traction, then the container does no longer start a brand new traction before calling the bean's method.

Q14. What Is

The javax.Traction.Tractional annotation provides the application the ability to control traction obstacles declaratively. This annotation can be implemented to any magnificence that the Java EE specification defines as a controlled bean (which includes CDI managed be).

Q15. Name Few Components Involved In The Distributed Traction Processing (dtp)?

The utility,

Application server,

Traction manager,

Resource adapter,

and the resource manager.

Q16. Does The J2ee Platform Support Nested Tractions?

No, the J2EE platform helps most effective flat tractions.

Q17. What Are Traction Attributes In Container-managed Tractions?

Traction characteristic determines the scope of a traction across be. For instance, if method () of Bean A starts offevolved a traction and calls technique () of bean b, then does technique () run inside the traction started out by approach (). This is decided through the traction attribute set on technique ()

A traction characteristic could have one of the following values:-

Required

Requires New

Mandatory

Not Supported

Supports

Never

Q18. Explain The Tractional Attribute Mandatory?

Use the Mandatory attribute if the company be technique ought to use the traction of the customer.

If the customer is jogging within a traction and invokes the agency be technique, the method executes inside the customers traction. If the patron isn't always associated with a traction, the container throws the Traction Required Exception.

Q19. What Is Java Traction Service (jts)?

JTS is a specification for enforcing a Java traction manager. A traction manager serves as an intermediary among an utility and one or extra traction-capable aid managers along with database servers and messaging structures. The JTA specification encompasses the JTA API specification.

Q20. Can An Entity Bean Use Bean-managed Traction Demarcation?

No. Entity be always use field-controlled traction demarcation. Session be can use both box-controlled or bean-managed traction demarcation, but not at the identical time.

Q21. What Is 'supports' Traction Attribute That Can Be Defined In Container-controlled Tractions?

If a client has an associated traction and calls a field-controlled bean approach then the technique executes inside the consumer traction.

If a client isn't always related to a traction, then the container does no longer begin a brand new traction earlier than calling the bean's method.

Q22. Should I Put A Tractional Attribute On An Asynchronous Action Such As Sending An Email?

No. Simply setting a tractional attribute on a technique might not assist if the resource supervisor can't use a tractional context.

Q23. What Is 'mandatory' Traction Attribute That Can Be Defined In Container-controlled Tractions?

If a patron has an associated traction and calls a container-controlled bean's method then the method executes within the consumer traction.

If a consumer is not associated with a traction then the container throws a TractionRequiredException.

Q24. What Is X/open Xa Architecture?

In the X/Open XA architecture, a traction supervisor or traction processing screen (TP reveal) coordinates the tractions across more than one assets such as databases and message queues. Each resource has its very own useful resource supervisor. The resource supervisor typically has its personal API for manipulating the resource, for example the JDBC API to work with relational databases. In addition, the useful resource manager lets in a TP reveal to coordinate a dispensed traction among its very own and different aid managers. Finally, there is the utility which communicates with the TP screen to begin, commit or rollback the tractions. The application also communicates with the person sources the use of their personal API to alter the useful resource.

Q25. What Is Resource Adapter In Jta Context?

The resource adapter is the issue that acts as a communications channel, or request trlator, among the "outdoor global,” the utility, and the useful resource manager. A JDBC motive force is an instance of resource adapter.

Q26. Explain The Tractional Attribute Required In Jta?

Required is the default traction attribute that guarantees the strategies are invoked within Java Traction API traction context. Required makes the tractional context utilized by the bean. If now not the brand new context could be created.

Q27. Difference Between A Traction And Distributed Traction?

A traction defines a logical unit of labor that both completely succeeds or produces no result in any respect.

A disbursed traction is definitely a traction that accessed and up to date records on  or extra networked assets, and therefore should be coordinated among the ones resources.

Q28. What Is The Never Traction Attribute That Can Be Defined In Container-controlled Tractions?

If a patron has an related traction and calls a field-managed bean's technique then the field throws a Remote Exception.

If a consumer is not associated with a traction, then the field does not start a new traction before calling the bean's approach.

Q29. How Do You Set Traction Timeouts In Container-controlled And Bean-controlled Tractions?

Container-Managed Traction - In box controlled tractions the traction timeout is set on the box's management console.

Bean-Managed Tractions - In Bean-managed tractions, the traction timeout is about by way of calling the setTractionTimeout () approach of the User Traction interface.




CFG