Note that there are some explanatory texts on larger screens.

plurals
  1. POFile attachments broken upgrading to grails 1.1.1 from grails 1.1-beta3
    text
    copied!<p>This is a rather specific upgrade path, but it's what I'm on. I think I tried going to 1.1 as well, and had the same problem, but not 100% sure.</p> <p>Anyway, I'm on 1.1-beta3 and have implemented a file upload/attachment system as outlined herer: <code>thegioraproject.com/2008/03/26/image-attachments-in-grails-using-imagemagick/</code></p> <p>I've got a 'broker' object which has a 'logo' (defined as an Image domain). The Image and Attachment (parent class) are done as defined in the above URL.</p> <p>In the brokerController, I've got code like this:</p> <pre><code> def file = new Image() def f = params.logo if(f.size&gt;0) { file.setFile(f) file?.save(flush:true) brokerUserInstance.logo?.delete() brokerUserInstance.logo = file } </code></pre> <p>The 'logo' is the name of the uploaded file from the form. After this code there's more standard grails CRUD code (<code>brokerUserInstance.properties=params</code>, <code>brokerUserInstance.save()</code>, etc). </p> <p>This works fine in 1.1-beta3. I can upload an image, it'll get thumbnailed and attached to the domain just fine (relations are in place in the db, etc). When I update the broker object without uploading a new image, the old one it kept intact.</p> <p>Moving to grails 1.1.1, when I try to upload a new image, I get:</p> <pre><code>Error 500: org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing: Image; nested exception is org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: Image </code></pre> <p>and if I don't upload an image, I get:</p> <pre><code>[org.springframework.web.multipart.commons.CommonsMultipartFile] to required type [Image] for property logo; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.springframework.web.multipart.commons.CommonsMultipartFile] to required type [Image] for property logo: no matching editors or conversion strategy found </code></pre> <p>I'm able to find pretty much 0 on this issue. Works fine in 1.1-beta3, but something's changed (dramatically) in 1.1.1 (and probably 1.1 as well).</p> <p>Any suggestions/ideas/help? I'm happy to grant server access to someone to help debug this.</p> <p>Thanks :)</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