Note that there are some explanatory texts on larger screens.

plurals
  1. POGrails GORM & Enums
    primarykey
    data
    text
    <p>I've a problem using Enumeration in Grails: I try to use an enumeraion in a grails domain object</p> <p>code:</p> <pre><code> package it.xxx.tools.kanban import java.util.Date; class Task { String name String description Priority priority static belongsTo = [user:User, project:Project] static constraints = { name(nullable:false, maxSize:25) description(nullable:false, maxSize:1500) priority(nullable:true) } } package it.xxx.tools.kanban; public enum Priority { VERY_LOW("Very Low"), LOW("Low"), MEDIUM("Medium"), HIGH("High"), VERY_HIGH("Very High") private final String value Priority(String value){ this.value = value; } String toString() { value } String getKey() { name() } static list(){ [VERY_LOW, LOW, MEDIUM, HIGH, VERY_HIGH] } } &lt;tr class="prop"&gt; &lt;td valign="top" class="name"&gt; &lt;label for="priority"&gt;Priority:&lt;/label&gt; &lt;/td&gt; &lt;td valign="top" class="value ${hasErrors(bean:taskInstance,field:'priority','errors')}"&gt; &lt;g:select from="${it.weservice.tools.kanban.Priority?.values()}" value="${taskInstance?.priority}" name="priority" noSelection="['':'']"&gt;&lt;/g:select&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>I use the grails generate-all command</p> <p>When I try to save via the web application the Task object I have the following error:</p> <pre><code>Failed to convert property value of type [java.lang.String] to required type [it.weservice.tools.kanban.Priority] for property priority; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [it.weservice.tools.kanban.Priority] for property priority: no matching editors or conversion strategy found </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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