Revision: 1493
Author: sberlin
Date: Sun Feb 13 17:12:20 2011
Log: issue 595 -- persist extension didn't work if @Transacation was on the
class, thanks to cgdecker for the patch and bug report!
http://code.google.com/p/google-guice/source/detail?r=1493
Modified:
/trunk/extensions/persist/src/com/google/inject/persist/PersistModule.java
/trunk/extensions/persist/test/com/google/inject/persist/jpa/ClassLevelManagedLocalTransactionsTest.java
=======================================
---
/trunk/extensions/persist/src/com/google/inject/persist/PersistModule.java
Wed Dec 8 19:57:44 2010
+++
/trunk/extensions/persist/src/com/google/inject/persist/PersistModule.java
Sun Feb 13 17:12:20 2011
@@ -37,6 +37,10 @@
requireBinding(UnitOfWork.class);
/*if[AOP]*/
// wrapping in an if[AOP] just to allow this to compile in NO_AOP --
it won't be used
+
+ // class-level @Transacational
+ bindInterceptor(annotatedWith(Transactional.class), any(),
getTransactionInterceptor());
+ // method-level @Transacational
bindInterceptor(any(), annotatedWith(Transactional.class),
getTransactionInterceptor());
/*end[AOP]*/
}
=======================================
---
/trunk/extensions/persist/test/com/google/inject/persist/jpa/ClassLevelManagedLocalTransactionsTest.java
Sun Sep 12 09:05:06 2010
+++
/trunk/extensions/persist/test/com/google/inject/persist/jpa/ClassLevelManagedLocalTransactionsTest.java
Sun Feb 13 17:12:20 2011
@@ -75,7 +75,7 @@
UNIQUE_TEXT, (((JpaTestEntity) result).getText()));
}
- public void disabled_testSimpleTransactionRollbackOnChecked() {
+ public void testSimpleTransactionRollbackOnChecked() {
try {
injector.getInstance(TransactionalObject2.class).runOperationInTxnThrowingChecked();
} catch (IOException e) {
@@ -120,7 +120,7 @@
result);
}
- public void disabled_testSimpleTransactionRollbackOnUnchecked() {
+ public void testSimpleTransactionRollbackOnUnchecked() {
try {
injector.getInstance(TransactionalObject4.class).runOperationInTxnThrowingUnchecked();
} catch (RuntimeException re) {
@@ -147,6 +147,7 @@
@Inject EntityManager session;
public void runOperationInTxn() {
+ assertTrue(session.getTransaction().isActive());
JpaTestEntity entity = new JpaTestEntity();
entity.setText(UNIQUE_TEXT);
session.persist(entity);
@@ -160,6 +161,7 @@
@Transactional
public void runOperationInTxnThrowingUnchecked() {
+ assertTrue(session.getTransaction().isActive());
JpaTestEntity entity = new JpaTestEntity();
entity.setText(TRANSIENT_UNIQUE_TEXT);
session.persist(entity);
@@ -173,6 +175,7 @@
@Inject EntityManager session;
public void runOperationInTxnThrowingCheckedExcepting() throws
IOException {
+ assertTrue(session.getTransaction().isActive());
JpaTestEntity entity = new JpaTestEntity();
entity.setText(UNIQUE_TEXT_2);
session.persist(entity);
@@ -186,6 +189,7 @@
@Inject EntityManager session;
public void runOperationInTxnThrowingChecked() throws IOException {
+ assertTrue(session.getTransaction().isActive());
JpaTestEntity entity = new JpaTestEntity();
entity.setText(TRANSIENT_UNIQUE_TEXT);
session.persist(entity);
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice-dev?hl=en.