|
15 | 15 | */
|
16 | 16 | package example.springdata.jpa.multipleds;
|
17 | 17 |
|
18 |
| -import javax.sql.DataSource; |
19 |
| - |
20 |
| -import lombok.NonNull; |
21 |
| -import lombok.RequiredArgsConstructor; |
22 |
| - |
23 |
| -import org.springframework.stereotype.Component; |
24 |
| -import org.springframework.transaction.annotation.Transactional; |
25 |
| -import org.springframework.util.Assert; |
26 |
| - |
27 | 18 | import example.springdata.jpa.multipleds.customer.Customer;
|
28 | 19 | import example.springdata.jpa.multipleds.customer.Customer.CustomerId;
|
29 | 20 | import example.springdata.jpa.multipleds.customer.CustomerRepository;
|
30 | 21 | import example.springdata.jpa.multipleds.order.Order;
|
31 | 22 | import example.springdata.jpa.multipleds.order.Order.LineItem;
|
32 | 23 | import example.springdata.jpa.multipleds.order.OrderRepository;
|
| 24 | +import lombok.NonNull; |
| 25 | +import lombok.RequiredArgsConstructor; |
| 26 | + |
| 27 | +import javax.sql.DataSource; |
| 28 | + |
| 29 | +import org.springframework.stereotype.Component; |
| 30 | +import org.springframework.transaction.annotation.Transactional; |
| 31 | +import org.springframework.util.Assert; |
33 | 32 |
|
34 | 33 | /**
|
35 | 34 | * Sample component to demonstrate how to work with repositories backed by different {@link DataSource}s. Note how we
|
36 | 35 | * explicitly select a transaction manager by name. In this particular case (only one operation on the repository) this
|
37 |
| - * is not strictly necessary. However, if multiple repositories or multiple interactions on the very same repsoitory are |
| 36 | + * is not strictly necessary. However, if multiple repositories or multiple interactions on the very same repository are |
38 | 37 | * to be executed in a method we need to expand the transaction boundary around these interactions. It's recommended to
|
39 | 38 | * create a dedicated annotation meta-annotated with {@code @Transactional("…")} to be able to refer to a particular
|
40 |
| - * datasource without using String qualifiers. |
| 39 | + * data source without using String qualifiers. |
41 | 40 | * <p>
|
42 | 41 | * Also, not that one cannot interact with both databases in a single, transactional method as transactions are thread
|
43 | 42 | * bound in Spring an thus only a single transaction can be active in a single thread. See {@link Application#init()}
|
|
0 commit comments