korma / Korma

Tasty SQL for Clojure.
http://sqlkorma.com
1.48k stars 222 forks source link

Change from jdbc.deprecated to maintained clojure.jdbc #207

Closed lokori closed 9 years ago

lokori commented 10 years ago

korma.db depends on deprecated version of clojure.jdbc API currently and it would be nice to depend on the maintained and non-deprecated API.

This is not merely about best practises, but has real life implications. Especially interesting is the way jdbc/transaction is handled in the deprecated version.

The deprecated version has a catch Exception for rollback/commit decisions. This leaves out other Throwables, which are not Exceptions. The non-deprecated version has fixed this transaction function properly.

What this means is that using Korma the transaction rollback/commit decision must either be handled with some custom code in the application level which is rude and difficult to do properly or be left to default behaviour inside the Java JDBC classes. The Java JDBC Connection.close() Javadoc states that "the results are implementation-defined" if the connection is closed and the transaction is still undecided. This is what happens in many Korma applications currently!

The fix should be relatively simple. Stop using the deprecated version of Clojure JDBC wrapper as they have already fixed this issue.

immoh commented 9 years ago

Implemented in 0.4.0