|
|
|
про роллбаск.
|
|||
|---|---|---|---|
|
#18+
привет уважаемые форумчане. есть непонимае теории по EJB3. имеем бин. @Stateless @TransactionManagement(TransactionManagementType.CONTAINER) public class ManagerApplications implements ManagerApplicationsInterface{ @PersistenceContext(name="PermissionManager", type=PersistenceContextType.TRANSACTION) EntityManager manager; @Resource SessionContext ejbContext; .... @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void tran(Object object){ ((Application)object).setShortname("proba"); manager.merge(object); ejbContext.setRollbackOnly(); } public Object uppObject(Object object){ System.out.println(ejbContext.getRollbackOnly()); manager.merge(object); tran(object); System.out.println(ejbContext.getRollbackOnly()); } } вопррос такой. если метод tran Объявлен как инициирующий новую транзакцию, то почему если я грю контейнеру откатить транзакцию ejbContext.setRollbackOnly(); в tranc, он откатывает и транзакцию в методе uppObject(), т.е. второй System.out.println(ejbContext.getRollbackOnly()); покажет труе, хотя по идее должен сказать false ? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.12.2006, 09:09:01 |
|
||
|
про роллбаск.
|
|||
|---|---|---|---|
|
#18+
народд ну неужели никто не знает ???? этожж основы ? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.12.2006, 14:18:57 |
|
||
|
про роллбаск.
|
|||
|---|---|---|---|
|
#18+
Если JBoss, то вот: Тыдыжь Вообще-то мне и не понятно как сервер должен перехватить прямой java method invoke чтобы вставить туда новую транзакицю. Это уже совсем АОП получается. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.12.2006, 14:42:31 |
|
||
|
про роллбаск.
|
|||
|---|---|---|---|
|
#18+
13.6.2.8 Handling of setRollbackOnly Method The container must handle the EJBContext.setRollbackOnly method invoked from a business method executing with the REQUIRED, REQUIRES_NEW, or MANDATORY transaction attribute as follows: The container must ensure that the transaction will never commit. Typically, the container instructs the transaction manager to mark the transaction for rollback. If the container initiated the transaction immediately before dispatching the business method to the instance (as opposed to the transaction being inherited from the caller), the container must note that the instance has invoked the setRollbackOnly method. When the business method invocation completes, the container must roll back rather than commit the transaction. If the business method has returned normally or with an application exception, the container must pass the method result or the application exception to the client after the container performed the rollback. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.12.2006, 15:10:52 |
|
||
|
про роллбаск.
|
|||
|---|---|---|---|
|
#18+
to Blazkowicz : выходит, что новая транзакция инициируется тока если вызов будет из другого бина ? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.12.2006, 16:06:53 |
|
||
|
про роллбаск.
|
|||
|---|---|---|---|
|
#18+
Не обязательно, можно попытаться получить проксю бина и дернуть метод. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 26.12.2006, 14:13:57 |
|
||
|
про роллбаск.
|
|||
|---|---|---|---|
|
#18+
Поковырял ещё вопрос. Суть в том что большинство реализаций AOP работают через проксированые вызовы. Когда класс дергает this метод, ни какой прокси естественно нет и перехватить вызов дабы наложиьт на него АОП некому. Единственный вариант проксирования с возможностью перехвата вызовов this это модификация байткода. Такое умеет например AspectJ. Вот со спрингами можно транзакции завязать через AspectJ. Как в этом случае морочатся с EJB - не представляю. Спека по этому поводу не достаточно ясна. И опять нужно смотреть вендорную реализацию. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.12.2006, 13:53:14 |
|
||
|
|

start [/forum/search_topic.php?author=hibernate+-+many-to-one&author_mode=last_posts&do_search=1]: |
0ms |
get settings: |
14ms |
get forum list: |
26ms |
get settings: |
19ms |
get forum list: |
26ms |
get settings: |
15ms |
get forum list: |
31ms |
check forum access: |
7ms |
check topic access: |
7ms |
track hit: |
57ms |
get topic data: |
20ms |
get forum data: |
5ms |
get page messages: |
68ms |
get tp. blocked users: |
3ms |
| others: | 922ms |
| total: | 1220ms |

| 0 / 0 |
