public class TestDAO {
public TestDAO() {
}
@Transactional(type=TxType.REQUIRED)
public void transactional() {
// bla
}
}
The problem:
We couldn't instantiate a new instance of it after it was enhanced, "new TestDAO();" would fail on an IllegalArgumentException. We fixed the problem in ScopeTransAdapter.setTxType(Object TxType). We changed it from:
private void setTxType(Object txType){
mv.visitVarInsn(ALOAD, posTxScope);
mv.visitLdcInsn(txType.toString());
mv.visitMethodInsn(INVOKESTATIC, C_TXTYPE, "valueOf", "(Ljava/lang/String;)L"+C_TXTYPE+";");
mv.visitMethodInsn(INVOKEVIRTUAL, C_TXSCOPE, "setType", "(L"+C_TXSCOPE+";)L"+C_TXSCOPE+";");
mv.visitInsn(POP);
}
Into:
private void setTxType(Object txType){
mv.visitVarInsn(ALOAD, posTxScope);
mv.visitLdcInsn(txType.toString());
mv.visitMethodInsn(INVOKESTATIC, C_TXTYPE, "valueOf", "(Ljava/lang/String;)L"+C_TXTYPE+";");
mv.visitMethodInsn(INVOKEVIRTUAL, C_TXSCOPE, "setType", "(L"+C_TXTYPE+";)L"+C_TXSCOPE+";");
mv.visitInsn(POP);
}