I'm new to Spring MVC and Spring Roo.
What is field enum?
How can I enumerate all allowed values?
Is it implemented using lookup table or check constraint?
Roo's field enum --fieldName --type
command adds a private field of the specified enum type.
You can create the enum type by hand or use roo commands:
roo> enum type --class ~.domain.Colors
roo> enum constant --name BLAU
roo> enum constant --name VERMELL
This creates a Colors enum:
public Enum Colors {
BLAU, VERMELL
}
Then you can use then enum type to define an entity field:
roo> entity --class ~.domain.Foo
roo> field enum --fieldName color --type ~.domain.Colors
This will define the Foo entity:
//Annotations and imports ommited for brevity
public class Foo{
private Colors color;
}
See http://static.springsource.org/spring-roo/reference/html/command-index.html for a complete reference of the roo commands.