{"id":8686,"date":"2024-01-06T15:44:03","date_gmt":"2024-01-06T15:44:03","guid":{"rendered":"https:\/\/ciit-training.com\/?p=8686"},"modified":"2024-01-06T16:17:20","modified_gmt":"2024-01-06T16:17:20","slug":"transactional-in-spring-how-it-works","status":"publish","type":"post","link":"https:\/\/ciit-training.com\/en\/2024\/01\/06\/transactional-in-spring-how-it-works\/","title":{"rendered":"@Transactional in Spring \u2013 how it works"},"content":{"rendered":"<div data-elementor-type=\"wp-post\" data-elementor-id=\"8686\" class=\"elementor elementor-8686\" data-elementor-post-type=\"post\">\n\t\t\t\t<div class=\"elementor-element elementor-element-2435da1 e-flex e-con-boxed e-con e-parent\" data-id=\"2435da1\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-a5ed020 exad-sticky-section-no exad-glass-effect-no elementor-widget elementor-widget-text-editor\" data-id=\"a5ed020\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h3><b>1. Introduction to Spring Framework and Transaction Management<\/b><\/h3><h4><span style=\"font-weight: 400;\">1.1 Overview of Spring Framework<\/span><\/h4><p><span style=\"font-weight: 400;\">The Spring Framework is an essential tool in the modern software development landscape, renowned for its robustness, flexibility, and comprehensive suite of features that streamline the development process. Originally developed to counter the complexities of early Java Enterprise Edition (JEE) solutions, Spring has evolved into a go-to framework for creating high-performing, scalable applications.<\/span><\/p><p><span style=\"font-weight: 400;\">At its core, Spring is built around the principle of dependency injection (DI) and aspect-oriented programming (AOP), allowing developers to create loosely coupled, manageable components. These components can be easily integrated, tested, and maintained, making Spring particularly suitable for enterprise-level applications.<\/span><\/p><p><span style=\"font-weight: 400;\">Key features of the Spring Framework include:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Inversion of Control (IoC) Container: Central to Spring, this feature manages the lifecycle and configuration of application objects.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Spring MVC: A model-view-controller framework that simplifies the development of web applications.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Data Access Framework: Provides a consistent approach to data access, whether it&#039;s JDBC, Hibernate, JPA, or other ORM technologies.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Spring Boot: A convention-over-configuration solution that accelerates application development by simplifying Spring setup.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Spring Security: Offers comprehensive security services for enterprise applications.<\/span><\/li><\/ul><h4><span style=\"font-weight: 400;\">1.2 Importance of Transaction Management in Software Development<\/span><\/h4><p><span style=\"font-weight: 400;\">Transaction management is a critical component in software development, particularly for applications dealing with data storage and retrieval. In simple terms, a transaction is a sequence of operations performed as a single, atomic unit. This concept is vital in ensuring data integrity and consistency, especially in systems where multiple concurrent operations occur.<\/span><\/p><p><span style=\"font-weight: 400;\">Effective transaction management means that either all operations in a transaction are successfully completed, or none are, maintaining the database&#039;s integrity. This is particularly crucial in applications like banking systems, e-commerce platforms, and any other system where data consistency is paramount.<\/span><\/p><h4><span style=\"font-weight: 400;\">1.3 Role of <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> in Spring<\/span><\/h4><p><span style=\"font-weight: 400;\">In the realm of Spring Framework, the <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> annotation plays a pivotal role in simplifying transaction management. By abstracting the underlying transaction handling, it allows developers to focus on business logic rather than the intricacies of transaction management.<\/span><\/p><p><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> offers several benefits:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Declarative Transaction Management: Instead of writing boilerplate code to handle transactions, developers can use this annotation to declaratively manage transactions.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Consistency and Safety: It ensures that the data remains consistent and safe throughout the transaction lifecycle.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Reduced Boilerplate Code: Reduces the amount of boilerplate code required for transaction management, thereby improving code readability and maintainability.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Flexibility and Customization: Allows customization of transactional behavior, such as propagation, isolation levels, timeout settings, and more.<\/span><\/li><\/ul><p><span style=\"font-weight: 400;\">In the following sections, we will delve deeper into how <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> works, its implementation, and best practices to leverage its full potential in Spring-based applications. We&#039;ll explore the technical aspects that make <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> a powerful annotation for managing transactions, ensuring data integrity, and streamlining the development process in complex enterprise applications.<\/span><\/p><p>\u00a0<\/p><h3><b>\u00a0<\/b><\/h3><h3><b>2. Understanding Transactions<\/b><\/h3><h4><span style=\"font-weight: 400;\">2.1 Definition and Importance of Transactions<\/span><\/h4><p><span style=\"font-weight: 400;\">In software development, a transaction typically refers to a series of operations or actions that are treated as a single unit of work. These operations must either all succeed or, if any of them fail, the entire transaction should fail and the system should revert to its previous state. This all-or-nothing approach is crucial for maintaining data integrity and consistency, especially in systems where data is constantly being read from and written to a database.<\/span><\/p><p><span style=\"font-weight: 400;\">Transactions are particularly important in applications that require a high level of data reliability, such as financial systems, e-commerce platforms, and customer data management systems. In these environments, the accuracy and consistency of data are paramount, and transaction management plays a critical role in ensuring these requirements are met.<\/span><\/p><h4><span style=\"font-weight: 400;\">2.2 ACID Properties of Transactions<\/span><\/h4><p><span style=\"font-weight: 400;\">The concept of transactions in computing is often explained through the ACID properties, which stand for Atomicity, Consistency, Isolation, and Durability:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Atomicity: This property ensures that all operations within a transaction are completed successfully. If any operation fails, the entire transaction is rolled back, meaning no operation within the failed transaction is applied to the database.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Consistency: Transactions must leave the database in a consistent state. This means that every transaction should start with the database in a consistent state and end with the database in a consistent state, even if the transaction is rolled back.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Isolation: This property ensures that transactions are protected from the interference of other concurrent transactions. It maintains data accuracy by ensuring that concurrent transactions cannot access data in an inconsistent state.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Durability: Once a transaction has been committed, it will remain so, even in the event of a system failure. This property ensures that the results of the operations are permanently stored in the database.<\/span><\/li><\/ul><h4><span style=\"font-weight: 400;\">2.3 Challenges in Transaction Management<\/span><\/h4><p><span style=\"font-weight: 400;\">Managing transactions effectively can be challenging due to several factors:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Complexity of State Management: Ensuring that the database remains in a consistent state throughout a transaction can be complex, especially when dealing with large volumes of data and multiple concurrent transactions.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Performance Overhead: Implementing transaction management, particularly in distributed systems, can introduce performance overhead. This is due to the additional processing required to ensure ACID properties.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Deadlocks and Concurrency Issues: Deadlocks can occur when two or more transactions are waiting for each other to release locks. Handling such scenarios and other concurrency issues is a key challenge in transaction management.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Scalability: As applications grow, managing transactions across a distributed database architecture becomes increasingly challenging.<\/span><\/li><\/ul><p><span style=\"font-weight: 400;\">Understanding these challenges is crucial for developers, as it helps in choosing the right transaction management strategy and in writing more efficient and reliable code. In the next section, we will explore how that <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> annotation in Spring addresses these challenges and simplifies transaction management in Java applications.<\/span><\/p><h3><b>\u00a0<\/b><\/h3><h3><b>3. Deep Dive into <\/b><b>@Transactional<\/b><b> Annotation<\/b><\/h3><h4><span style=\"font-weight: 400;\">3.1 Basic Usage of <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><\/h4><p><span style=\"font-weight: 400;\">The <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> annotation in Spring is a declarative way of managing transactions in your Java applications. When a method annotated with <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> is executed, Spring Framework automatically starts a new transaction. This simplification removes the need for manual transaction handling (like explicitly starting or committing a transaction) and lets developers focus on business logic.<\/span><\/p><p><span style=\"font-weight: 400;\">A typical usage of <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> might look like this:<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-29cfcfd e-flex e-con-boxed e-con e-parent\" data-id=\"29cfcfd\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-8b29290 exad-sticky-section-no exad-glass-effect-no elementor-widget elementor-widget-code-highlight\" data-id=\"8b29290\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\tpackage at.ciit.spring.example1; import at.ciit.spring.CustomException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service public class MyService { @Transactional public void myTransactionalMethod() { \/\/ Business logic that requires transactional support } }\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-c833dc7 e-flex e-con-boxed e-con e-parent\" data-id=\"c833dc7\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-fee39bf exad-sticky-section-no exad-glass-effect-no elementor-widget elementor-widget-text-editor\" data-id=\"fee39bf\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span style=\"font-weight: 400;\">In this example, <\/span><span style=\"font-weight: 400;\">myTransactionalMethod<\/span><span style=\"font-weight: 400;\"> will be executed within a transactional context provided by Spring.<\/span><\/p><h4><span style=\"font-weight: 400;\">3.2 How Spring Implements Transaction Management<\/span><\/h4><p><span style=\"font-weight: 400;\">Spring Framework&#039;s transaction management is implemented using a combination of AOP (Aspect-Oriented Programming) and proxying. When a class is annotated with <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> or contains methods with this annotation, Spring dynamically creates a proxy that wraps the class. This proxy is responsible for managing the transaction lifecycle (start, commit, rollback) based on the method&#039;s execution outcome.<\/span><\/p><p><span style=\"font-weight: 400;\">Here&#039;s a simplified view of the process:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Proxy Creation: When the application starts, Spring scans for <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> annotations and creates proxies for the affected beans.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Transaction Handling: When a transactional method is invoked, the proxy intercepts the call and starts a new transaction (or joins an existing one, depending on the propagation settings).<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Commit or Rollback: If the method completes successfully, the transaction is committed. If an exception is thrown, the transaction is rolled back.<\/span><\/li><\/ul><h4><span style=\"font-weight: 400;\">3.3 Behind the Scenes: Proxy Mechanism and AOP<\/span><\/h4><p><span style=\"font-weight: 400;\">The proxy mechanism is central to how <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> works. Spring uses either JDK dynamic proxies (when interfaces are available) or CGLIB proxies (for class-based proxying) to create these transactional proxies. The choice between JDK and CGLIB proxies can be influenced by various factors, including whether the target object implements an interface.<\/span><\/p><p><span style=\"font-weight: 400;\">AOP plays a crucial role here, as it allows the separation of transaction management from business logic. The <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> annotation is, in essence, an aspect that Spring applies to the target method. This aspect manages the transaction lifecycle transparently, ensuring that the method is executed within the bounds of a transaction.<\/span><\/p><p><span style=\"font-weight: 400;\">This section sets the stage for understanding the various attributes and configurations available with <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\">, which will be explored in the subsequent sections. These attributes allow for fine-tuning transactional behavior to suit different requirements and scenarios, making <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> a powerful and flexible tool in the Spring ecosystem.<\/span><\/p><p>\u00a0<\/p><h3><b>4. Core Concepts of Transaction Management in Spring<\/b><\/h3><h4><span style=\"font-weight: 400;\">4.1 Propagation Behavior of Transactions<\/span><\/h4><p><span style=\"font-weight: 400;\">One of the key aspects of <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> is the control of transaction boundaries through propagation behavior. Spring provides several options for propagation, which determine how transactions are handled relative to each other. The most commonly used propagation behaviors include:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">REQUIRED (default): Supports the current transaction; creates a new one if none exists.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">REQUIRES_NEW: Creates a new transaction, suspending the current one if it exists.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">SUPPORTS: Runs within a transaction if one is already present; otherwise, runs non-transactionally.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">NOT_SUPPORTED: Executes non-transactionally, suspending any current transaction.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">MANDATORY: Supports the current transaction; throws an exception if no current transaction exists.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">NEVER: Ensures the method is not run within a transaction; throws an exception if a transaction exists.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">NESTED: Executes within a nested transaction if a current transaction exists; otherwise, behaves like REQUIRED.<\/span><\/li><\/ul><p><span style=\"font-weight: 400;\">Understanding these behaviors is crucial for correctly managing transaction demarcation, especially in complex applications with multiple transactional methods interacting with each other.<\/span><\/p><h4><span style=\"font-weight: 400;\">4.2 Isolation Levels in Transactions<\/span><\/h4><p><span style=\"font-weight: 400;\">Isolation levels define how data accessed by one transaction is isolated from other transactions. In Spring, the <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> annotation allows specifying the isolation level, which is critical for preventing concurrency-related issues like dirty reads, non-repeatable reads, and phantom reads. The standard isolation levels include:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">DEFAULT: Uses the default isolation level of the underlying datastore.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">READ_UNCOMMITTED: Allows dirty reads; one transaction may see uncommitted changes made by another.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">READ_COMMITTED: Prevents dirty reads; data read is committed at the point of reading.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">REPEATABLE_READ: Ensures repeatable reads; data read cannot change during the transaction.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">SERIALIZABLE: The highest level; complete isolation from other transactions.<\/span><\/li><\/ul><p><span style=\"font-weight: 400;\">Choosing the appropriate isolation level depends on the specific requirements of the application and its tolerance for concurrency side-effects.<\/span><\/p><h4><span style=\"font-weight: 400;\">4.3 Rollback Rules and Exception Handling<\/span><\/h4><p><span style=\"font-weight: 400;\">Spring provides a flexible way to define rollback behavior in <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\">. By default, a transaction will roll back on runtime, unchecked exceptions (like <\/span><span style=\"font-weight: 400;\">RuntimeException<\/span><span style=\"font-weight: 400;\">) but not on checked exceptions. However, this behavior can be customized using the <\/span><span style=\"font-weight: 400;\">rollbackFor<\/span><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400;\">noRollbackFor<\/span><span style=\"font-weight: 400;\"> attributes of the <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> annotation.<\/span><\/p><p><span style=\"font-weight: 400;\">For example:<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-2835053 e-flex e-con-boxed e-con e-parent\" data-id=\"2835053\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-4a3cbe1 exad-sticky-section-no exad-glass-effect-no elementor-widget elementor-widget-code-highlight\" data-id=\"4a3cbe1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\tpackage at.ciit.spring.example2; import at.ciit.spring.CustomException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service public class MyService { @Transactional(rollbackFor = {CustomException.class}) public void myMethod() { \/\/ Business logic } }\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-2519491 e-flex e-con-boxed e-con e-parent\" data-id=\"2519491\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-1ddc003 exad-sticky-section-no exad-glass-effect-no elementor-widget elementor-widget-text-editor\" data-id=\"1ddc003\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span style=\"font-weight: 400;\">This configuration specifies that the transaction should roll back for <\/span><span style=\"font-weight: 400;\">CustomException<\/span><span style=\"font-weight: 400;\">.<\/span><\/p><p><span style=\"font-weight: 400;\">Understanding and correctly configuring rollback rules is vital for maintaining data and handling exceptions effectively in a transactional context.<\/span><\/p><p><span style=\"font-weight: 400;\">\u00a0<\/span><\/p><p>\u00a0<\/p><h3><b>5. Advanced Features of <\/b><b>@Transactional<\/b><\/h3><h4><span style=\"font-weight: 400;\">5.1 Programmatically Managing Transactions<\/span><\/h4><p><span style=\"font-weight: 400;\">While the <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> annotation provides a declarative way of managing transactions, Spring also allows for programmatic transaction management. This can be particularly useful in scenarios where you need more control over the transaction, such as in complex business logic that requires dynamic transaction management.<\/span><\/p><p><span style=\"font-weight: 400;\">Programmatic transaction management in Spring is typically achieved through the <\/span><span style=\"font-weight: 400;\">PlatformTransactionManager<\/span><span style=\"font-weight: 400;\"> interface. Here&#039;s a simple example:<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-b9270b0 e-flex e-con-boxed e-con e-parent\" data-id=\"b9270b0\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-ccd7661 exad-sticky-section-no exad-glass-effect-no elementor-widget elementor-widget-code-highlight\" data-id=\"ccd7661\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\tpackage at.ciit.spring.example3; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.support.DefaultTransactionDefinition; @Transactional public class MyService { private final PlatformTransactionManager transactionManager; public MyService(PlatformTransactionManager transactionManager) { this.transactionManager = transactionManager; } public void myMethod() { DefaultTransactionDefinition def = new DefaultTransactionDefinition(); TransactionStatus status = transactionManager.getTransaction(def); try { \/\/ Business logic transactionManager.commit(status); } catch (Exception ex) { transactionManager.rollback(status); throw ex; } } }\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-c4218e6 e-flex e-con-boxed e-con e-parent\" data-id=\"c4218e6\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-a8fc533 exad-sticky-section-no exad-glass-effect-no elementor-widget elementor-widget-text-editor\" data-id=\"a8fc533\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span style=\"font-weight: 400;\">In this example, the <\/span><span style=\"font-weight: 400;\">PlatformTransactionManager<\/span><span style=\"font-weight: 400;\"> is used to manually start, commit, and roll back transactions.<\/span><\/p><h4><span style=\"font-weight: 400;\">5.2 Transaction Synchronization and Event Handling<\/span><\/h4><p><span style=\"font-weight: 400;\">Spring provides the ability to synchronize business logic with transaction events, such as on transaction completion or rollback. This feature is valuable for performing certain operations only after the transaction has been committed or rolled back.<\/span><\/p><p><span style=\"font-weight: 400;\">You can register a <\/span><span style=\"font-weight: 400;\">Transaction Synchronization<\/span><span style=\"font-weight: 400;\"> with Spring&#039;s <\/span><span style=\"font-weight: 400;\">TransactionSynchronizationManager<\/span><span style=\"font-weight: 400;\">, which provides callback methods like <\/span><span style=\"font-weight: 400;\">beforeCommit<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">afterCommit<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">beforeCompletion<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">afterCompletion<\/span><span style=\"font-weight: 400;\">, etc. These methods can be overridden to execute custom logic at specific points in the transaction lifecycle.<\/span><\/p><h4><span style=\"font-weight: 400;\">5.3 Custom Transaction Strategies with <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><\/h4><p><span style=\"font-weight: 400;\">The flexibility of the <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> annotation extends to allowing the development of custom transaction strategies. This is achieved by combining various attributes of the annotation, such as <\/span><span style=\"font-weight: 400;\">propagation<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">isolation<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">time-out<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">readOnly<\/span><span style=\"font-weight: 400;\">, and the rules for exception handling (<\/span><span style=\"font-weight: 400;\">rollbackFor<\/span><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400;\">noRollbackFor<\/span><span style=\"font-weight: 400;\">).<\/span><\/p><p><span style=\"font-weight: 400;\">For instance, you can create a transactional method that:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Starts a new transaction if none exists (<\/span><span style=\"font-weight: 400;\">propagation=REQUIRES_NEW<\/span><span style=\"font-weight: 400;\">).<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Has a custom timeout (<\/span><span style=\"font-weight: 400;\">timeout=5<\/span><span style=\"font-weight: 400;\">), meaning the transaction will be rolled back if it takes more than 5 seconds.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Is read-only (<\/span><span style=\"font-weight: 400;\">readOnly=true<\/span><span style=\"font-weight: 400;\">), which can optimize performance for read-only operations.<\/span><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-2743e56 e-flex e-con-boxed e-con e-parent\" data-id=\"2743e56\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-99e684e exad-sticky-section-no exad-glass-effect-no elementor-widget elementor-widget-code-highlight\" data-id=\"99e684e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\tpackage at.ciit.spring.example4; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @Transactional public class MyService { @Transactional(propagation = Propagation.REQUIRES_NEW, timeout = 5, readOnly = true) public void myReadOnlyOperation() { \/\/ Read-only business logic } }\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-3242f13 e-flex e-con-boxed e-con e-parent\" data-id=\"3242f13\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-26e90af exad-sticky-section-no exad-glass-effect-no elementor-widget elementor-widget-text-editor\" data-id=\"26e90af\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span style=\"font-weight: 400;\">These advanced features of <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> enable developers to create sophisticated and highly customizable transaction management strategies. This flexibility is essential for addressing the diverse needs of complex enterprise applications.<\/span><\/p><p><span style=\"font-weight: 400;\">In the next section, we will discuss best practices and common pitfalls to be aware of when using <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> in Spring applications.<\/span><\/p><p>\u00a0<\/p><h3><b>6. Best Practices and Common Pitfalls<\/b><\/h3><h4><span style=\"font-weight: 400;\">6.1 Proper Usage of <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> in Application Layers<\/span><\/h4><p><span style=\"font-weight: 400;\">One of the most critical best practices in using <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> is understanding where it should be applied within the application layers. Commonly, it is most effective at the service layer rather than the data access layer (DAO) or the controller layer. This approach ensures that the transactional boundaries are around business logic, thereby providing better control over transactions and making the system more robust.<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Service Layer: Ideal for <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> as it typically encapsulates business logic and calls multiple DAO methods, which should be part of the same transaction.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Data Access Layer (DAO): Avoid using <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> here, as it can lead to multiple transactions within a single business process.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Controller Layer: Generally not recommended, as controllers should not be aware of transaction management.<\/span><\/li><\/ul><h4><span style=\"font-weight: 400;\">6.2 Performance Considerations and Optimizations<\/span><\/h4><p><span style=\"font-weight: 400;\">Transaction management can have a significant impact on application performance. It&#039;s important to consider the following:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Avoid Long Transactions: Long-running transactions can hold database locks for extended periods, affecting performance. Keep transactions as short as possible.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Read-Only Transactions: Mark transactions as read-only whenever possible. This can optimize database performance and resource utilization.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Lazy Loading: Be cautious with lazy loading within transactions. Accessing lazy-loaded data outside of the transactional context can lead to issues like LazyInitializationException.<\/span><\/li><\/ul><h4><span style=\"font-weight: 400;\">6.3 Troubleshooting Common Issues<\/span><\/h4><p><span style=\"font-weight: 400;\">When working with <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\">, developers may encounter certain issues. Here are some common pitfalls and how to address them:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Transaction Not Starting: Ensure that the method with <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> is being called from outside its own class. Transactions won&#039;t start if the method is called internally due to the way Spring AOP works.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Unexpected Rollbacks: Be aware of the default rollback behavior. Spring rolls back on unchecked exceptions but not on checked ones. Customize this behavior with the <\/span><span style=\"font-weight: 400;\">rollbackFor<\/span><span style=\"font-weight: 400;\"> attribute if necessary.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Proxying Issues: Remember that Spring uses proxies for transaction management. Final classes and methods can&#039;t be proxied using Spring&#039;s default AOP proxying mechanism.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Isolation Level Conflicts: Understand the impact of different isolation levels on your application, especially in terms of performance and concurrency behavior.<\/span><\/li><\/ul><p><span style=\"font-weight: 400;\">Adhering to these best practices and being aware of common pitfalls will greatly enhance the effectiveness of <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> in your Spring applications. The next sections will cover case studies and real-world scenarios, providing practical insights into applying these concepts effectively.<\/span><\/p><p>\u00a0<\/p><h3><b>7. Case Studies and Real-World Scenarios<\/b><\/h3><h4><span style=\"font-weight: 400;\">7.1 Integrating <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> with Various Database Systems<\/span><\/h4><p><span style=\"font-weight: 400;\">Different database systems, like MySQL, PostgreSQL, Oracle, and NoSQL databases, can have varying behaviors and requirements for transaction management. How <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> is leveraged can significantly impact its effectiveness in different database environments.<\/span><\/p><p><span style=\"font-weight: 400;\">Case Study: Transitioning from Oracle to MySQL<\/span><span style=\"font-weight: 400;\"><br \/><\/span><span style=\"font-weight: 400;\">In this scenario, a financial application initially developed for Oracle is migrated to MySQL. The development team must adjust the transaction management strategies due to differences in default isolation levels and locking behaviors between these databases. For instance, Oracle&#039;s default level of <\/span><span style=\"font-weight: 400;\">READ_COMMITTED<\/span><span style=\"font-weight: 400;\"> might need to be explicitly set in MySQL to avoid issues like phantom reads.<\/span><\/p><p><span style=\"font-weight: 400;\">Best Practices:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Test transactional behavior thoroughly when switching databases.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Adjust isolation levels and transactional settings according to the database&#039;s characteristics.<\/span><\/li><\/ul><h4><span style=\"font-weight: 400;\">7.2 Transaction Management in Distributed Systems<\/span><\/h4><p><span style=\"font-weight: 400;\">Managing transactions across microservices or distributed architectures introduces additional complexity. This is because operations may span multiple databases or external systems, requiring coordinated transactions.<\/span><\/p><p><span style=\"font-weight: 400;\">Case Study: Implementing Distributed Transactions in Microservices<\/span><span style=\"font-weight: 400;\"><br \/><\/span><span style=\"font-weight: 400;\">A retail company uses microservices for different aspects of its business \u2013 orders, inventory, and shipping. Implementing a transaction that spans these services requires a strategy like two-phase commit or employing a distributed transaction management framework.<\/span><\/p><p><span style=\"font-weight: 400;\">Best Practices:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Avoid distributed transactions if possible by designing each service to be self-contained.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">If unavoidable, use patterns like Saga to manage distributed transactions.<\/span><\/li><\/ul><h4><span style=\"font-weight: 400;\">7.3 Lessons from Real-World Applications<\/span><\/h4><p><span style=\"font-weight: 400;\">Real-world applications often provide valuable insights into the practical challenges and solutions in transaction management.<\/span><\/p><p><span style=\"font-weight: 400;\">Case Study: E-Commerce Platform Scalability<\/span><span style=\"font-weight: 400;\"><br \/><\/span><span style=\"font-weight: 400;\">An e-commerce platform experiences high transaction volumes during peak sales periods. The platform needs to handle concurrent transactions efficiently while maintaining data integrity.<\/span><\/p><p><span style=\"font-weight: 400;\">Best Practices:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Implement appropriate isolation levels to balance data consistency and performance.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Use read replicas for read-only transactions to reduce the load on the primary database.<\/span><\/li><\/ul><h4><span style=\"font-weight: 400;\">7.4 Handling Complex Transactions with Spring<\/span><\/h4><p><span style=\"font-weight: 400;\">Complex transactions, such as those involving conditional logic or multiple data sources, require careful planning and implementation.<\/span><\/p><p><span style=\"font-weight: 400;\">Case Study: Financial Reporting System<\/span><span style=\"font-weight: 400;\"><br \/><\/span><span style=\"font-weight: 400;\">A financial system needs to generate reports by aggregating data from multiple sources. This process involves complex transactions where partial failure in data fetching should not halt the entire reporting process.<\/span><\/p><p><span style=\"font-weight: 400;\">Best Practices:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Use <\/span><span style=\"font-weight: 400;\">REQUIRES_NEW<\/span><span style=\"font-weight: 400;\"> or <\/span><span style=\"font-weight: 400;\">NESTED<\/span><span style=\"font-weight: 400;\"> propagation for subtransactions that should be independent.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Handle exceptions strategically to ensure partial success of the overall transaction.<\/span><\/li><\/ul><p>\u00a0<\/p><h3><b>8. Conclusion<\/b><\/h3><h4><span style=\"font-weight: 400;\">8.1 Summarizing the Role and Impact of <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><\/h4><p><span style=\"font-weight: 400;\">The <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> annotation in the Spring Framework stands out as a pivotal element in simplifying transaction management in Java applications. Throughout this article, we have explored the depths of <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\">, from its basic usage and internal workings to advanced features and best practices. Its ability to manage transaction boundaries declaratively makes it an invaluable tool for developers, enabling them to focus on business logic rather than the intricacies of transaction handling.<\/span><\/p><h4><span style=\"font-weight: 400;\">8.2 Key Takeaways<\/span><\/h4><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ease of Use: <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> provides a straightforward, declarative approach to handle transactions, drastically reducing boilerplate code.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Flexibility: Through various attributes like propagation, isolation levels, and custom rollback rules, <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> offers flexibility to cater to diverse transaction management needs.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Enhanced Reliability and Consistency: It ensures that data integrity and consistency are maintained across transactions, which is crucial for the robustness of enterprise applications.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Performance Considerations: Understanding the nuances of <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> can lead to better performance optimizations and more efficient application design.<\/span><\/li><\/ul><h4><span style=\"font-weight: 400;\">8.3 Future Trends in Transaction Management<\/span><\/h4><p><span style=\"font-weight: 400;\">As technology evolves, so does the landscape of transaction management. We are likely to see advancements in areas like:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Distributed Transaction Management: With the rise of microservices and distributed architectures, new patterns and tools for managing distributed transactions will emerge.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Integration with Reactive Programming: As reactive programming gains popularity, transaction management in reactive environments will become more relevant.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Enhanced Support for NoSQL Databases: As NoSQL databases become more prevalent, we can expect improved transaction support and optimizations in this area.<\/span><\/li><\/ul><h4><span style=\"font-weight: 400;\">8.4 Final Thoughts<\/span><\/h4><p><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> in Spring represents a powerful abstraction for transaction management, blending simplicity with flexibility. The continued evolution of Spring and its transaction management capabilities is poised to keep pace with the changing demands of modern application development.<\/span><\/p><p><span style=\"font-weight: 400;\">As we conclude, it&#039;s evident that a deep understanding of <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> and transaction management principles is essential for building reliable, high-performing, and maintainable Java applications. By leveraging the insights and best practices discussed in this article, developers can harness the full potential of <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> in their Spring applications.<\/span><\/p><p>\u00a0<\/p><h3><b>9. References and Further Reading<\/b><\/h3><p><span style=\"font-weight: 400;\">In order to deepen your understanding of <\/span><span style=\"font-weight: 400;\">@Transactional<\/span><span style=\"font-weight: 400;\"> in Spring and related topics, the following resources are highly recommended. These materials range from official documentation to insightful books and articles, providing both foundational knowledge and advanced insights into transaction management with Spring.<\/span><\/p><h4><span style=\"font-weight: 400;\">9.1 Official Documentation<\/span><\/h4><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Spring Framework Documentation:<\/span><ul><li style=\"font-weight: 400;\" aria-level=\"2\"><a href=\"https:\/\/docs.spring.io\/spring-framework\/reference\/data-access\/transaction.html\">Transaction Management<\/a><\/li><li style=\"font-weight: 400;\" aria-level=\"2\"><a href=\"https:\/\/docs.spring.io\/spring-framework\/reference\/data-access\/transaction\/declarative\/annotations.html\">Using @Transactional<\/a><\/li><\/ul><\/li><\/ul><h4><span style=\"font-weight: 400;\">9.2 Books<\/span><\/h4><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><a href=\"https:\/\/www.manning.com\/books\/spring-in-action-sixth-edition\">\u201eSpring into Action\u201c by Craig Walls:<\/a><\/span><a href=\"https:\/\/www.amazon.com\/-\/de\/dp\/1617297577\/ref=sr_1_1?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&amp;crid=1PVB05T14ZJ4S&amp;keywords=Spring+in+Action&amp;qid=1704556539&amp;sprefix=spring+in+actio%2Caps%2C223&amp;sr=8-1\"><br \/><\/a><ul><li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">A highly regarded book in the Spring community, offering practical examples and in-depth explanations.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Covers various aspects of Spring, including transaction management.<\/span><\/li><\/ul><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/link.springer.com\/book\/10.1007\/978-1-4842-8640-1\"><span style=\"font-weight: 400;\">\u201ePro Spring 6: An In-Depth Guide to the Spring Framework\u201c<\/span><\/a><ul><li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Provides a comprehensive exploration of Spring 5, including detailed coverage of transaction management.<\/span><\/li><\/ul><\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-1f47b50 e-flex e-con-boxed e-con e-parent\" data-id=\"1f47b50\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-4a44e91 exad-sticky-section-no exad-glass-effect-no elementor-widget elementor-widget-text-editor\" data-id=\"4a44e91\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>\u00a0<\/p><h3 dir=\"ltr\" style=\"line-height: 1.92; margin-top: 0pt; margin-bottom: 4pt;\"><span style=\"font-size: 16.5pt; font-family: Roboto,sans-serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;\">10. Further Examples<\/span><\/h3><div><h4 dir=\"ltr\" style=\"line-height: 1.7999999999999998; margin-top: 12pt; margin-bottom: 2pt;\"><span style=\"font-size: 12pt; background-color: transparent; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-variant-position: normal; vertical-align: baseline;\">10.1 A Service &amp; 2 Repositories in one transaction<\/span><\/h4><div><span style=\"font-weight: var( --e-global-typography-text-font-weight ); text-align: var(--text-align); color: #374151; font-family: S\u00f6hne, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; white-space-collapse: preserve;\">Below is a code example demonstrating a Spring Service method calling two Spring Data repositories within a single transaction. The service method is annotated with <\/span><code style=\"color: var(--tw-prose-code); text-align: var(--text-align); border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; font-size: 0.875em; font-weight: 600; white-space-collapse: preserve; font-family: 'S\u00f6hne Mono', Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;\">@Transactional<\/code><span style=\"font-weight: var( --e-global-typography-text-font-weight ); text-align: var(--text-align); color: #374151; font-family: S\u00f6hne, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; white-space-collapse: preserve;\">, ensuring that both repository calls are part of the same transaction.<\/span><\/div><\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-b3aaa0a e-flex e-con-boxed e-con e-parent\" data-id=\"b3aaa0a\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-723fc3b exad-sticky-section-no exad-glass-effect-no elementor-widget elementor-widget-code-highlight\" data-id=\"723fc3b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\tpackage at.ciit.spring.example10_1; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.dao.DataAccessException; @Service public class MySpringService { private final MyFirstRepository firstRepository; private final MySecondRepository secondRepository; @Autowired public MySpringService(MyFirstRepository firstRepository, MySecondRepository secondRepository) { this.firstRepository = firstRepository; this.secondRepository = secondRepository; } @Transactional public void updateData(DataObject1 dataObject1, DataObject2 dataObject2) { try { \/\/ First repository call firstRepository.save(dataObject1); \/\/ Second repository call secondRepository.save(dataObject2); } catch (DataAccessException ex) { \/\/ Exception handling logic \/\/ The transaction will automatically roll back in case of any DataAccessException throw ex; } } }\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-2448d16 e-flex e-con-boxed e-con e-parent\" data-id=\"2448d16\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-9b431fe exad-sticky-section-no exad-glass-effect-no elementor-widget elementor-widget-code-highlight\" data-id=\"9b431fe\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\tpackage at.ciit.spring.example10_1; import org.springframework.data.jpa.repository.JpaRepository; \/\/ Example repository interfaces public interface MyFirstRepository extends JpaRepository&lt;DataObject1, Long&gt; { \/\/ Custom methods for DataObject1 }\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-eb0f0e6 e-flex e-con-boxed e-con e-parent\" data-id=\"eb0f0e6\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-84a273b exad-sticky-section-no exad-glass-effect-no elementor-widget elementor-widget-code-highlight\" data-id=\"84a273b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard\">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\tpackage at.ciit.spring.example10_1; import org.springframework.data.jpa.repository.JpaRepository; public interface MySecondRepository extends JpaRepository&lt;DataObject2, Long&gt; { \/\/ Custom methods for DataObject2 }\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-863e0ad e-flex e-con-boxed e-con e-parent\" data-id=\"863e0ad\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-8140200 exad-sticky-section-no exad-glass-effect-no elementor-widget elementor-widget-text-editor\" data-id=\"8140200\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>\u00a0<\/p><p style=\"border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; margin: 1.25em 0px; color: #374151; font-family: S\u00f6hne, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-weight: 400; white-space-collapse: preserve;\">In this example:<\/p><ul style=\"border-style: solid; border-color: #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; list-style-position: initial; list-style-image: initial; margin: 1.25em 0px; padding: 0px; display: flex; flex-direction: column; color: #374151; font-family: S\u00f6hne, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-weight: 400; white-space-collapse: preserve;\"><li style=\"border-style: solid; border-color: #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; margin: 0px; padding-left: 0.375em; display: block; min-height: 28px;\">The <code style=\"border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; font-size: 0.875em; color: var(--tw-prose-code); font-weight: 600; margin-top: 1.25em; font-family: 'S\u00f6hne Mono', Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;\">MySpringService<\/code> class is marked as a Spring service using <code style=\"border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; font-size: 0.875em; color: var(--tw-prose-code); font-weight: 600; margin-bottom: 1.25em; font-family: 'S\u00f6hne Mono', Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;\">@Service<\/code>.<\/li><li style=\"border-style: solid; border-color: #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; margin: 0px; padding-left: 0.375em; display: block; min-height: 28px;\">The <code style=\"border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; font-size: 0.875em; color: var(--tw-prose-code); font-weight: 600; margin-top: 1.25em; font-family: 'S\u00f6hne Mono', Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;\">updateData<\/code> method, annotated with <code style=\"border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; font-size: 0.875em; color: var(--tw-prose-code); font-weight: 600; font-family: 'S\u00f6hne Mono', Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;\">@Transactional<\/code>, ensures that both operations on <code style=\"border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; font-size: 0.875em; color: var(--tw-prose-code); font-weight: 600; font-family: 'S\u00f6hne Mono', Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;\">firstRepository<\/code> and <code style=\"border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; font-size: 0.875em; color: var(--tw-prose-code); font-weight: 600; margin-bottom: 1.25em; font-family: 'S\u00f6hne Mono', Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;\">secondRepository<\/code> are within the same transaction boundary.<\/li><li style=\"border-style: solid; border-color: #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; margin: 0px; padding-left: 0.375em; display: block; min-height: 28px;\">If any exception, particularly <code style=\"border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; font-size: 0.875em; color: var(--tw-prose-code); font-weight: 600; margin-top: 1.25em; margin-bottom: 1.25em; font-family: 'S\u00f6hne Mono', Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;\">DataAccessException<\/code>, occurs during the execution of either repository method, the transaction will automatically roll back, maintaining data integrity.<\/li><li style=\"border-style: solid; border-color: #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; margin: 0px; padding-left: 0.375em; display: block; min-height: 28px;\">The <code style=\"border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; font-size: 0.875em; color: var(--tw-prose-code); font-weight: 600; margin-top: 1.25em; font-family: 'S\u00f6hne Mono', Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;\">MyFirstRepository<\/code> and <code style=\"border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; font-size: 0.875em; color: var(--tw-prose-code); font-weight: 600; font-family: 'S\u00f6hne Mono', Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;\">MySecondRepository<\/code> are typical Spring Data repository interfaces extending <code style=\"border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; font-size: 0.875em; color: var(--tw-prose-code); font-weight: 600; font-family: 'S\u00f6hne Mono', Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;\">JpaRepository<\/code>, tailored for <code style=\"border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; font-size: 0.875em; color: var(--tw-prose-code); font-weight: 600; font-family: 'S\u00f6hne Mono', Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;\">DataObject1<\/code> and <code style=\"border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; font-size: 0.875em; color: var(--tw-prose-code); font-weight: 600; margin-bottom: 1.25em; font-family: 'S\u00f6hne Mono', Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;\">DataObject2<\/code> entities respectively.<\/li><\/ul><p style=\"border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; margin: 1.25em 0px 0px; color: #374151; font-family: S\u00f6hne, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-weight: 400; white-space-collapse: preserve;\">This code demonstrates how Spring&#039;s <code style=\"border: 0px solid #d9d9e3; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; font-size: 0.875em; color: var(--tw-prose-code); font-weight: 600; font-family: 'S\u00f6hne Mono', Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important;\">@Transactional<\/code> annotation can be used to manage transactions spanning multiple repository calls in a cohesive and streamlined manner.<\/p><div>\u00a0<\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-bc34704 e-flex e-con-boxed e-con e-parent\" data-id=\"bc34704\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-381256f exad-sticky-section-no exad-glass-effect-no elementor-widget elementor-widget-image\" data-id=\"381256f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"800\" height=\"800\" src=\"https:\/\/ciit-training.com\/wp-content\/uploads\/sites\/2\/2024\/01\/transactional.avif\" class=\"attachment-large size-large wp-image-8688\" alt=\"\" srcset=\"https:\/\/ciit-training.com\/wp-content\/uploads\/sites\/2\/2024\/01\/transactional.avif 1024w, https:\/\/ciit-training.com\/wp-content\/uploads\/sites\/2\/2024\/01\/transactional-300x300.avif 300w, https:\/\/ciit-training.com\/wp-content\/uploads\/sites\/2\/2024\/01\/transactional-150x150.avif 150w, https:\/\/ciit-training.com\/wp-content\/uploads\/sites\/2\/2024\/01\/transactional-768x768.avif 768w, https:\/\/ciit-training.com\/wp-content\/uploads\/sites\/2\/2024\/01\/transactional-12x12.avif 12w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>This article provides an in-depth exploration of Spring Framework&#039;s @Transactional annotation, detailing its functionality, implementation, advanced features, and best practices for effective transaction management in Java applications.<\/p>","protected":false},"author":8,"featured_media":8688,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[52,54,53,55],"class_list":["post-8686","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-transactional","tag-spring-boot","tag-sring-data","tag-transactions"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>@Transactional in Spring - how it works - CIIT Training<\/title>\n<meta name=\"description\" content=\"GPTDer Artikel bietet einen umfassenden Einblick in die Funktionsweise und Anwendung von @Transactional in Spring f\u00fcr effektives Transaktionsmanagement.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ciit-training.com\/en\/2024\/01\/06\/transactional-in-spring-how-it-works\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"@Transactional in Spring - how it works - CIIT Training\" \/>\n<meta property=\"og:description\" content=\"GPTDer Artikel bietet einen umfassenden Einblick in die Funktionsweise und Anwendung von @Transactional in Spring f\u00fcr effektives Transaktionsmanagement.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ciit-training.com\/en\/2024\/01\/06\/transactional-in-spring-how-it-works\/\" \/>\n<meta property=\"og:site_name\" content=\"CIIT Training\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javatraining.at\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-06T15:44:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-06T16:17:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ciit-training.com\/wp-content\/uploads\/sites\/2\/2023\/11\/CIIT_Logo_BrightBackground_Blau_ohne_at.png\" \/>\n\t<meta property=\"og:image:width\" content=\"512\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Michael Schaffler-Gl\u00f6\u00dfl\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JavaTrainingAT\" \/>\n<meta name=\"twitter:site\" content=\"@JavaTrainingAT\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Schaffler-Gl\u00f6\u00dfl\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"19 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\\\/\\\/ciit-training.com\\\/2024\\\/01\\\/06\\\/transactional-in-spring-how-it-works\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ciit-training.com\\\/2024\\\/01\\\/06\\\/transactional-in-spring-how-it-works\\\/\"},\"author\":{\"name\":\"Michael Schaffler-Gl\u00f6\u00dfl\",\"@id\":\"https:\\\/\\\/ciit-training.com\\\/#\\\/schema\\\/person\\\/a4b77611f602115013aca7ecdfa1cde2\"},\"headline\":\"@Transactional in Spring &#8211; how it works\",\"datePublished\":\"2024-01-06T15:44:03+00:00\",\"dateModified\":\"2024-01-06T16:17:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ciit-training.com\\\/2024\\\/01\\\/06\\\/transactional-in-spring-how-it-works\\\/\"},\"wordCount\":3313,\"publisher\":{\"@id\":\"https:\\\/\\\/ciit-training.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/ciit-training.com\\\/2024\\\/01\\\/06\\\/transactional-in-spring-how-it-works\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/ciit-training.com\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/01\\\/transactional.avif\",\"keywords\":[\"@Transactional\",\"Spring Boot\",\"Sring Data\",\"Transactions\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ciit-training.com\\\/2024\\\/01\\\/06\\\/transactional-in-spring-how-it-works\\\/\",\"url\":\"https:\\\/\\\/ciit-training.com\\\/2024\\\/01\\\/06\\\/transactional-in-spring-how-it-works\\\/\",\"name\":\"@Transactional in Spring - how it works - CIIT Training\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ciit-training.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ciit-training.com\\\/2024\\\/01\\\/06\\\/transactional-in-spring-how-it-works\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ciit-training.com\\\/2024\\\/01\\\/06\\\/transactional-in-spring-how-it-works\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/ciit-training.com\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/01\\\/transactional.avif\",\"datePublished\":\"2024-01-06T15:44:03+00:00\",\"dateModified\":\"2024-01-06T16:17:20+00:00\",\"description\":\"GPTDer Artikel bietet einen umfassenden Einblick in die Funktionsweise und Anwendung von @Transactional in Spring f\u00fcr effektives Transaktionsmanagement.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ciit-training.com\\\/2024\\\/01\\\/06\\\/transactional-in-spring-how-it-works\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ciit-training.com\\\/2024\\\/01\\\/06\\\/transactional-in-spring-how-it-works\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ciit-training.com\\\/2024\\\/01\\\/06\\\/transactional-in-spring-how-it-works\\\/#primaryimage\",\"url\":\"https:\\\/\\\/ciit-training.com\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/01\\\/transactional.avif\",\"contentUrl\":\"https:\\\/\\\/ciit-training.com\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/01\\\/transactional.avif\",\"width\":1024,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ciit-training.com\\\/2024\\\/01\\\/06\\\/transactional-in-spring-how-it-works\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ciit-training.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"@Transactional in Spring &#8211; how it works\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ciit-training.com\\\/#website\",\"url\":\"https:\\\/\\\/ciit-training.com\\\/\",\"name\":\"CIIT Training\",\"description\":\"Javatraing\",\"publisher\":{\"@id\":\"https:\\\/\\\/ciit-training.com\\\/#organization\"},\"alternateName\":\"Javatraining\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ciit-training.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/ciit-training.com\\\/#organization\",\"name\":\"CIIT GmbH\",\"alternateName\":\"Schaffler & Gl\u00f6\u00dfl GmbH\",\"url\":\"https:\\\/\\\/ciit-training.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ciit-training.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/ciit-training.com\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/11\\\/CIIT_Logo_BrightBackground_Blau_ohne_at.png\",\"contentUrl\":\"https:\\\/\\\/ciit-training.com\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/11\\\/CIIT_Logo_BrightBackground_Blau_ohne_at.png\",\"width\":512,\"height\":512,\"caption\":\"CIIT GmbH\"},\"image\":{\"@id\":\"https:\\\/\\\/ciit-training.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javatraining.at\",\"https:\\\/\\\/x.com\\\/JavaTrainingAT\",\"https:\\\/\\\/www.linkedin.com\\\/showcase\\\/javatraining.at\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ciit-training.com\\\/#\\\/schema\\\/person\\\/a4b77611f602115013aca7ecdfa1cde2\",\"name\":\"Michael Schaffler-Gl\u00f6\u00dfl\",\"url\":\"https:\\\/\\\/ciit-training.com\\\/en\\\/author\\\/michael\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"@Transactional in Spring - how it works - CIIT Training","description":"GPTDer Artikel bietet einen umfassenden Einblick in die Funktionsweise und Anwendung von @Transactional in Spring f\u00fcr effektives Transaktionsmanagement.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ciit-training.com\/en\/2024\/01\/06\/transactional-in-spring-how-it-works\/","og_locale":"en_US","og_type":"article","og_title":"@Transactional in Spring - how it works - CIIT Training","og_description":"GPTDer Artikel bietet einen umfassenden Einblick in die Funktionsweise und Anwendung von @Transactional in Spring f\u00fcr effektives Transaktionsmanagement.","og_url":"https:\/\/ciit-training.com\/en\/2024\/01\/06\/transactional-in-spring-how-it-works\/","og_site_name":"CIIT Training","article_publisher":"https:\/\/www.facebook.com\/javatraining.at","article_published_time":"2024-01-06T15:44:03+00:00","article_modified_time":"2024-01-06T16:17:20+00:00","og_image":[{"width":512,"height":512,"url":"https:\/\/ciit-training.com\/wp-content\/uploads\/sites\/2\/2023\/11\/CIIT_Logo_BrightBackground_Blau_ohne_at.png","type":"image\/png"}],"author":"Michael Schaffler-Gl\u00f6\u00dfl","twitter_card":"summary_large_image","twitter_creator":"@JavaTrainingAT","twitter_site":"@JavaTrainingAT","twitter_misc":{"Written by":"Michael Schaffler-Gl\u00f6\u00dfl","Est. reading time":"19 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/ciit-training.com\/2024\/01\/06\/transactional-in-spring-how-it-works\/#article","isPartOf":{"@id":"https:\/\/ciit-training.com\/2024\/01\/06\/transactional-in-spring-how-it-works\/"},"author":{"name":"Michael Schaffler-Gl\u00f6\u00dfl","@id":"https:\/\/ciit-training.com\/#\/schema\/person\/a4b77611f602115013aca7ecdfa1cde2"},"headline":"@Transactional in Spring &#8211; how it works","datePublished":"2024-01-06T15:44:03+00:00","dateModified":"2024-01-06T16:17:20+00:00","mainEntityOfPage":{"@id":"https:\/\/ciit-training.com\/2024\/01\/06\/transactional-in-spring-how-it-works\/"},"wordCount":3313,"publisher":{"@id":"https:\/\/ciit-training.com\/#organization"},"image":{"@id":"https:\/\/ciit-training.com\/2024\/01\/06\/transactional-in-spring-how-it-works\/#primaryimage"},"thumbnailUrl":"https:\/\/ciit-training.com\/wp-content\/uploads\/sites\/2\/2024\/01\/transactional.avif","keywords":["@Transactional","Spring Boot","Sring Data","Transactions"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/ciit-training.com\/2024\/01\/06\/transactional-in-spring-how-it-works\/","url":"https:\/\/ciit-training.com\/2024\/01\/06\/transactional-in-spring-how-it-works\/","name":"@Transactional in Spring - how it works - CIIT Training","isPartOf":{"@id":"https:\/\/ciit-training.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ciit-training.com\/2024\/01\/06\/transactional-in-spring-how-it-works\/#primaryimage"},"image":{"@id":"https:\/\/ciit-training.com\/2024\/01\/06\/transactional-in-spring-how-it-works\/#primaryimage"},"thumbnailUrl":"https:\/\/ciit-training.com\/wp-content\/uploads\/sites\/2\/2024\/01\/transactional.avif","datePublished":"2024-01-06T15:44:03+00:00","dateModified":"2024-01-06T16:17:20+00:00","description":"GPTDer Artikel bietet einen umfassenden Einblick in die Funktionsweise und Anwendung von @Transactional in Spring f\u00fcr effektives Transaktionsmanagement.","breadcrumb":{"@id":"https:\/\/ciit-training.com\/2024\/01\/06\/transactional-in-spring-how-it-works\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ciit-training.com\/2024\/01\/06\/transactional-in-spring-how-it-works\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ciit-training.com\/2024\/01\/06\/transactional-in-spring-how-it-works\/#primaryimage","url":"https:\/\/ciit-training.com\/wp-content\/uploads\/sites\/2\/2024\/01\/transactional.avif","contentUrl":"https:\/\/ciit-training.com\/wp-content\/uploads\/sites\/2\/2024\/01\/transactional.avif","width":1024,"height":1024},{"@type":"BreadcrumbList","@id":"https:\/\/ciit-training.com\/2024\/01\/06\/transactional-in-spring-how-it-works\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ciit-training.com\/"},{"@type":"ListItem","position":2,"name":"@Transactional in Spring &#8211; how it works"}]},{"@type":"WebSite","@id":"https:\/\/ciit-training.com\/#website","url":"https:\/\/ciit-training.com\/","name":"CIIT Training","description":"Java training","publisher":{"@id":"https:\/\/ciit-training.com\/#organization"},"alternateName":"Javatraining","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ciit-training.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ciit-training.com\/#organization","name":"CIIT GmbH","alternateName":"Schaffler & Gl\u00f6\u00dfl GmbH","url":"https:\/\/ciit-training.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ciit-training.com\/#\/schema\/logo\/image\/","url":"https:\/\/ciit-training.com\/wp-content\/uploads\/sites\/2\/2023\/11\/CIIT_Logo_BrightBackground_Blau_ohne_at.png","contentUrl":"https:\/\/ciit-training.com\/wp-content\/uploads\/sites\/2\/2023\/11\/CIIT_Logo_BrightBackground_Blau_ohne_at.png","width":512,"height":512,"caption":"CIIT GmbH"},"image":{"@id":"https:\/\/ciit-training.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javatraining.at","https:\/\/x.com\/JavaTrainingAT","https:\/\/www.linkedin.com\/showcase\/javatraining.at\/"]},{"@type":"Person","@id":"https:\/\/ciit-training.com\/#\/schema\/person\/a4b77611f602115013aca7ecdfa1cde2","name":"Michael Schaffler-Gl\u00f6\u00dfl","url":"https:\/\/ciit-training.com\/en\/author\/michael\/"}]}},"_links":{"self":[{"href":"https:\/\/ciit-training.com\/en\/wp-json\/wp\/v2\/posts\/8686","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ciit-training.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ciit-training.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ciit-training.com\/en\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/ciit-training.com\/en\/wp-json\/wp\/v2\/comments?post=8686"}],"version-history":[{"count":0,"href":"https:\/\/ciit-training.com\/en\/wp-json\/wp\/v2\/posts\/8686\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ciit-training.com\/en\/wp-json\/wp\/v2\/media\/8688"}],"wp:attachment":[{"href":"https:\/\/ciit-training.com\/en\/wp-json\/wp\/v2\/media?parent=8686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ciit-training.com\/en\/wp-json\/wp\/v2\/categories?post=8686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ciit-training.com\/en\/wp-json\/wp\/v2\/tags?post=8686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}