Hi,
We are migrating JPA provider from Hibernate to Kundera-redis and get problem with AOP, for instance,
Guice-JPA.
Here is how we use it:
--------
@Transactional
public void initDatabase() {
em.createQuery("DELETE FROM Employee").executeUpdate(); // 1
em.createQuery("DELETE FROM Company").executeUpdate(); // 2
// insert new data
}
--------
Line 1 execute successfully but line 2 failed with following exception:
--------
redis.clients.jedis.exceptions.JedisDataException: ERR DISCARD without MULTI
at redis.clients.jedis.Protocol.processError(Protocol.java:54)
at redis.clients.jedis.Protocol.process(Protocol.java:61)
at redis.clients.jedis.Protocol.read(Protocol.java:122)
at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:152)
at redis.clients.jedis.BinaryTransaction.discard(BinaryTransaction.java:41)
at com.impetus.client.redis.RedisTransaction.onRollback(RedisTransaction.java:87)
at com.impetus.kundera.persistence.Coordinator.coordinate(Coordinator.java:86)
at com.impetus.kundera.persistence.KunderaEntityTransaction.onTransaction(KunderaEntityTransaction.java:128)
at com.impetus.kundera.persistence.KunderaEntityTransaction.rollback(KunderaEntityTransaction.java:120)
at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.rollbackIfNecessary(JpaLocalTxnInterceptor.java:152)
at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
--------
I traced into Kundera source code and found this:
1. At "RedisTransaction.bindResource(Jedis)", line 134, the first execute fire "tx = resource.multi();"
2. At "RedisClient.onExecuteQuery(RedisQueryInterpreter, Class)", line 1543, RedisTransaction is committed by "((Transaction) connection).exec();"
3. Section execute, at "RedisTransaction.bindResource(Jedis)", line 139, tx is reused without calling multi(). I guess this is where the problem happens.
Is it a bug or do I miss something here?
BTW, I am using Kundera 2.10. I clone the code from Github but failed to run the testcase on my local Machine.
--------
[WARNING] The POM for com.impetus.kundera.core:kundera-core:jar:2.11-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.impetus.kundera.core:kundera-core:jar:tests:2.11-SNAPSHOT is missing, no dependency information available
--------
And I couldn't found a way to switch the branch to 2.10.
Please help. Thanks in advance.
Regards
Hank