(defmulti parse-int type)
(defmethod parse-int java.lang.Integer [n] n)
(defmethod parse-int java.lang.String [s] (Integer/parseInt s))
(defn get-a-member [id]
(layout/render "member/profile2.html"
{:member (db/get-member-url (parse-int id))}
(session/put! :member-id (parse-int id))))
So parse-int ensures id is specified as an integer for postgres.
I have another question. I'd like to get the username from this result set and put it in session. How would I add that to the above code. If I add :username username to the session PUT statement, it doesn't recognize it.
(defn get-a-member [id]
(layout/render "member/profile2.html"
{:member (db/get-member-url (parse-int id))}
(session/put! :member-id (parse-int id) :username username)))
So I look up the record, and from that record I want to extract id and username and put them in session as member-id and username.
Btw, would you recommend using an ORM or straight java.jdbc and if an ORM, any particular one you'd recommend?
Best,
Pardeep.