• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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.
 
There is no beard big enough to make me comfortable enough with my masculinity to wear pink. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic