The Quick Korma Crash Course
This is the ultra quick and dirty guide to Korma. We'll use the existing artists and albums tables in the hipstr database, between which a simple 1-artist-to-many-albums relationship exists:
We'll gloss over just enough to make use of Korma for these two tables and how they relate to one another in the database. You can get a far more detailed and richer overview of everything Korma provides by visiting the official site at http://www.sqlkorma.com/docs.
Define the database specification
You define the database Korma will use by using the korma.db/defdb
macro. The defdb
macro accepts a standard JDBC database map, similar to the one we created in the hipstr.models.connection
namespace:
(defdb hipstr-db {:classname "org.postgresql.Driver" :subprotocol "postgresql" :subname "//localhost/postgres" :user "hipstr" :password "p455w0rd...