Note that there are some explanatory texts on larger screens.

plurals
  1. POGrails (Hibernate) does select before insert without passing id argument value
    text
    copied!<p>I'm starting more serious tests of my grails web-app and it was time to move from hsqldb to postgres. Everything went more or less ok, however I'm getting an error in Bootstrap when creating test data. Hibernate tries to do a select before inserting a row into the database. Unfortunately, when doing so it does not pass an argument to the select and I'm getting exception saying the parameter 1 value was not specified.</p> <p>Here's my domain class:</p> <pre><code>class User { static constraints = { deviceId( blank: false, unique: true, ) userName(nullable: true, size: 5..15, blank: false, unique: true) password(nullable: true, size: 5..15, blank: false) email(nullable: true, email: true, blank: false, unique: true) blockedUsers(unique: true) } static mapping = { table "player" deviceId indexColumn: [name: "deviceId", unique: true] } static mappedBy = [inbox: 'userTo', outbox: 'userFrom'] static hasMany = [profiles: Profile, inbox: Message, outbox: Message, blockedUsers: User] List&lt;User&gt; blockedUsers = new ArrayList&lt;User&gt;() String deviceId String userName String email String password Boolean readyForExport = false Boolean newUser = false [...] } </code></pre> <p>so there's nothing special about it. Before this error I've got quite a few .save(flush:true) commands on other domains and everything is fine. It's just this one that throws the error :/</p> <p>These are the lines responsible for this error.</p> <pre><code>User userA = new User(userName: "test", password: "dkjughey3htg", email: "integration@test.com", deviceId: 'intTestDevice') userA.save(flush:true) </code></pre> <p>Any tips why this would happen?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload