• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

IllegalArgumentException when using clj-record's create function

 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying clj-record with Postgresql 8.2. I have a table called "users", and a domain class called "user". When using the "create" function on "user", the following exception is thrown : java.lang.IllegalArgumentException: Record does not exist (NO_SOURCE_FILE:0)

Actually, the record is successfully inserted...

The "create" function inserts and retrieves the inserted record. It looks like there's a problem with the id used for retrieving the record. I tried calling the "insert" function directly, and it returns nil. My "users" tables has the following layout:


Has anybody any idea why the record is not correctly fetched ?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Solved ! The "insert" function calls "id-query-for", which is a multimethod. For postgresql, the function is :

which means that the id column must be called "id", and that it must be "serial". My table layout looks like that :


I don't quite like the fact that the column id is fixed to "id".....
 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course nothing wrong with clj-record but have a look at ClojureQL also:
https://github.com/LauJensen/clojureql
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks John, I'll have a look at it. Actually I'm reading Clojure In Action, and the chapter on data storage is using clj-record and MySql. I decided to use Postgresql instead, as it's already installed on my machine, and I started to run into troubles...
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cool, please lets us read your "Clojure in Action" review.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

John Todd wrote:Cool, please lets us read your "Clojure in Action" review.


It's here.
 
them good ole boys were drinking whiskey and rye singin' this'll be the day that I die. Drink tiny ad.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic