Your code looks really familiarfamiliar ;) . If super.create()
fails, then the super class throws an exception and the entire transaction is rolled back. If you throw an exception in your connectDB method, the entire transaction be rolled back as well. So, instead of doing an e.printStackTrace
everywhere, you should throw the exception.
If that doesn't work, have a look at this Storage Extension code, which essentially does the same as you are trying to do, but it instead calls the 'extra' action inside the
commitTransaction()
method after the super method has committed.
Another, and maybe simpler, alternative is to first call your updateDB method and then the super.create()
method. In this case you will also need to throw Exceptions rather than eating them up.