spring jdbc I want just one sql transaction how many hoops did you make you fools you blind arrogant fools
-
So okay, to add some detail. Originally, the plan was to (needlessly, mind you, this is a personal project that I am willfully and in full awareness overengineering) get a transaction around some bulk inserts. So fine. A try, a probably avoidable fail flag but whatever, a set autocommit off, the inserts which are documented not to commit the transaction which is documented to be a capability of the database, clear the fail flag, finally commit or rollback, and a couple basic tests injecting failures into the process to verify the rollbacks. But oh no, I am using spring jdbc and so far, had been getting along with it, but somehow somewhere , no measurable rollback. So okay fine. I decide, I'll play it Spring's way a little bit farther.
So enter Transactional and EnableTransactionManagement and why not AspectJ because having your class be able to call itself and not bork is nice, and three more dependencies to support them having eventually been identified and all , and all the gears gotten to be whirring and such .
However, the tests still show no rollback to occur. But I do feel so much cleaner now.
-
@gribnit Welcome back!
-
thanks!
-
@gribnit So how many transactions did you get?
-
I got no transactions as measured by repeatable tests to determine whether rollback has actually occurred, but all the whirring gears added are whirring! Sure beats setting autocommit off, handling a simple failure flag via basic language features, and having to use arcane SQL words in a finally, I can tell you, I just feel so clean, like I've sat on a fire hydrant for a bit.
-
@Gribnit The title was a good lead-in, but the post was pretty disappointing. A bit more detail would've been nice.
-
Wait, why is this in the Garage?
-
@anotherusername Would it really have been category appropriate if I had included more detail?
-
@gribnit I guess maybe it would.
-
@pie_flavor Probably I don't know what the categories are for. I was hoping to troll Spring afficionados.
-
@gribnit said in spring jdbc I want one fucking sql transaction assholes how many fucking hoops did you make you fools you blind arrogant fools:
I was hoping to troll Spring afficionados.
I like the core of Spring so long as I don't look under the covers , but I don't like Spring JDBC. I also don't really care for Spring Web, but that might be because it is solving problems that I don't have and isn't solving problems that I do have. (The Spring Security extension to Spring Web is better, or at least a lot less annoying than doing the security parts of a webservice directly.)
-
@gribnit The garage is where politics and controversial topics are flamewarred about. Flamewars over tech is what the rest of the forum is for.
-
@dkf said in spring jdbc I want one fucking sql transaction assholes how many fucking hoops did you make you fools you blind arrogant fools:
I like the core of Spring so long as I don't look under the covers
How drunk were you when you brought it home? ;)
-
Moving to sidebar.
-
@gribnit said in spring jdbc I want one fucking sql transaction assholes how many fucking hoops did you make you fools you blind arrogant fools:
capability of the database
Which database?
-
@boomzilla H2 embedded, in memory for the test. To be fair, there's
DELETE
to check too. I'd feel it right to be pissed ifINSERT
didn't implicit commit andDELETE
did, though.
-
@gribnit I guess maybe it wasn't
-
spring jdbc
-
@pie_flavor The test being insanely paranoid might contribute, of course. I've been piling straws on this camel for awhile now. There was a point where everything was a Spy, which I've backed slightly off from.
-
@boomzilla The data in question is already fully represented as an
enum
, I'm just writing it to the database to support sane joins for ad-hoc queries (none of which are predicted to be required, see "willfully and in full awareness overengineered")
-
@gribnit Wow, this takes me back to one of my ex-CTO's ranting about how it requires you to throw a runtime exception before it wants to roll back, and how this obviously breaks methods which at all times are expected to return something.
In the end I think they
extend
ed the Spring code to do what they wanted or just built their own version of the aspects.
-
@gribnit said in spring jdbc I want one fucking sql transaction assholes how many fucking hoops did you make you fools you blind arrogant fools:
You're just pretending to be Remy Porter…
-
@dkf I might not have been, but I think I will now. Where do I apply for my banned-from-se-for-no-discernible-reason badge?
-
@jbert meh, I'm fine with
RuntimeException
since Java 8 has forced me kicking and screaming to be, it's already my domain exception superclass.
-
..
-
-
@pie_flavor How the heck does that make the text invisible?
-
-
@gribnit said in spring jdbc I want one fucking sql transaction assholes how many fucking hoops did you make you fools you blind arrogant fools:
I was hoping to troll
you were hoping to troll people by putting your topic in the one category only read by trolls?
-
@gribnit In other news, logs of what Spring says it is doing show rollback to be being said to be occurring at the critical point for all the test runs, single, en-suite, or integrated. And the database is in what I think is a known state prior to the body of each run, because as far as I know I'm verifying it per run.
-
@ben_lubar Now that you say it like that, it seems like an even better idea.
-
-
@gribnit Well, on to ablating for regression, because no I didn't clean up each change that failed to affect the test as I went.
-
@gribnit said in spring jdbc I want just one sql transaction how many hoops did you make you fools you blind arrogant fools:
Good. I thought you might be a robot or something.
-
Golly, what'd you feed the text to to come up with that conclusion. In other news, ablation testing is proceeding, hampered by IntelliJ's current lack of effective notion as to when to run the code weaver. But in the best case, maybe I'll be able to get rid of that too.
-
@gribnit Well, that's 139/139 passing tests yielding 100% line coverage again, then, with all ablations complete. Guess I'm keeping these damn aspects though. Fuck Spring.
-
@pie_flavor And for some reason it indents your signature?
-
@gribnit Isn't "ablation" the thing they coat spaceships with so they don't explode on reentry?
-
@blakeyrat Ablation is the process of that stuff getting scoured off by the heat and force of re-entry. Or, if the ablative shielding is not properly applied or damaged, the process of significant parts of the ship getting scoured off by the heat and force of re-entry, as we have unfortunately seen.
-
@gribnit said in spring jdbc I want just one sql transaction how many hoops did you make you fools you blind arrogant fools:
There's an easier way:
Filed under: Of course, there's no effect on the
hamburgerthree cherries menu to show what spawned the dropdown...
-
@scarlet_manuka that's an ablative coating. yeah. the concept is far more universal and describes any process that proceeds by gradual removal.
-
@gribnit Yes, I know, but I couldn't be bothered getting into the details.
-
Thread punchline - nothing ever reads from the tables involved in the transaction, ever. That's by design. :D
-
@gribnit Wat?
-
@hardwaregeek Well I never said I needed the transaction. I just wanted it.
-
-
@hardwaregeek I did say right off that this was willfully and in full awareness over-engineereed.