Enum as an ordinal in an embedded class

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Enum as an ordinal in an embedded class

elvanor
Hello,

I have a main domain class embedding a second one (let's say House embeds owner of class Person).

Person.groovy is under src/groovy and has an enum property, that I need to use as an ordinal in MySQL.

I defined the mapping block on the Person class:

        static mapping =
        {
                unit("enumType": "ordinal")
        }

but it does not seem to work. Hibernate creates the table with the correct definition but later I get exceptions (Caused by: java.lang.IllegalArgumentException: No enum const class com.kameleoon.decoration.CSSUnit.1), which means it does not understand the 1 should be converted to the propert Enum class.

Can someone please help me there? Is it a bug, or is there a workaround?
Reply | Threaded
Open this post in threaded view
|

Re: Enum as an ordinal in an embedded class

elvanor
Hmm, actually I solved the problem, it worked as expected.

My issues were due to the fact that the MySQL table had kept the old definition around (I was looking at the wrong table and missed the real problem).