Ugh, previous message got sent before I finished typing. Here we go again...
(defun get-producer-id (name) (or (query (:select 'id :from 'producer :where (:= 'name name))) (let ((new-producer (make-instance 'producer :name name)) (insert-dao new-producer) (get-id new-producer))))
Does that work (it is probably full of typos and mistakes, but you get the idea).
Cheers, Marijn