Any ideas on how to maintain a collection of listings in Grails?
Groovy listing:
public enum MyEnum { AAA('Aaa'), BEE('Bee'), CEE('Cee') String description MyEnum(String description) { this.description = description } static belongsTo = [tester:Tester] }
I want to use this enumeration in a Grails domain class. The domain class is as follows:
class Tester { static hasMany = [myenums: MyEnum] static constraints = { } }
In my create.jsp, I want to be able to select multiple MyEnums and have the following line:
<g:select from="${MyEnum?.values()}" multiple="multiple" value="${testerInstance?.myenums}" name="myenums" ></g:select>`
The problem that I get is when I try to create a new tester, I get 500 error message:
Exception Message: java.lang.String cannot be cast to java.lang.Enum Caused by: java.lang.String cannot be cast to java.lang.Enum Class: TesterController
source share