Announcement Announcement Module
No announcement yet.
Unable to add ENUM type to entity Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sreeni Chippada
    started a topic Unable to add ENUM type to entity

    Unable to add ENUM type to entity

    I am new to spring roo and gwt and trying to play with them.
    My environment is Eclipse Kepler 4.3.2, spring-roo-1.2.6.BUILD-SNAPSHOT_20140514, GWT 2.6.0.

    Created a project with name "Course" and with org.rooinaction.course as the topLevelPackage in eclipse and then executed the following script from roo shell (example taken from "Spring Roo in Action" Book)

    =========== Script Start===============
    logging setup --level WARN
    logging setup --level TRACE --package PROJECT
    persistence setup --provider HIBERNATE --database MYSQL --databaseName msrct
    database properties set --key database.username --value root
    database properties set --key database.password --value password

    entity jpa --class ~.model.Course --testAutomatically
    field string --fieldName name
    field number --fieldName listPrice --type java.math.BigDecimal
    field string --fieldName description
    field number --fieldName maximumCapacity --type java.lang.Integer
    field date --fieldName runDate --type java.util.Date --persistenceType JPA_DATE --dateFormat SHORT

    enum type --class ~.model.CourseTypeEnum
    enum constant --name SEMINAR
    enum constant --name CREDIT
    enum constant --name CONTINUING_EDUCATION

    focus --class ~.model.Course

    field enum --fieldName courseType --type ~.model.CourseTypeEnum --enumType STRING

    web gwt setup

    web gwt all --proxyPackage ~.client.proxy --requestPackage ~.client.request
    ===============Script End====================

    While executing the script from the roo shell, I get the following message:
    Updated SRC_MAIN_JAVA/org/rooinaction/course/client/proxy/
    The path to type org.rooinaction.course.model.CourseTypeEnum which is used in type org.rooinaction.course.model.Course by the field 'getCourseType' needs to be added to the module's gwt.xml file in order to be used in a Proxy. has defined courseType correctly as shown below:

    private CourseTypeEnum courseType;

    Course_Roo_JavaBean.aj has the getter setter methods defined:

    public CourseTypeEnum Course.getCourseType() {
    return this.courseType;

    public void Course.setCourseType(CourseTypeEnum courseType) {
    this.courseType = courseType;
    But the doesn't have the corresponding methods defined.

    package org.rooinaction.course.client.proxy;
    import yProxy;
    import ForName;
    import java.math.BigDecimal;
    import java.util.Date;
    import org.springframework.roo.addon.gwt.RooGwtProxy;

    @ProxyForName(value = "org.rooinaction.course.model.Course", locator = "org.rooinaction.course.server.locator.CourseLocat or")
    @RooGwtProxy(value = "org.rooinaction.course.model.Course", readOnly = { "version", "id" }, scaffold = true)
    public interface CourseProxy extends EntityProxy {

    abstract Long getId();

    abstract String getName();

    abstract void setName(String name);

    abstract BigDecimal getListPrice();

    abstract void setListPrice(BigDecimal listPrice);

    abstract String getDescription();

    abstract void setDescription(String description);

    abstract Integer getMaximumCapacity();

    abstract void setMaximumCapacity(Integer maximumCapacity);

    abstract Date getRunDate();

    abstract void setRunDate(Date runDate);

    abstract Integer getVersion();

    I did try adding the following 2 lines to the ApplicationScaffold.gwt.xml
    <source path="org/rooinaction/course/model/CourseTypeEnum"/>
    <source path="org/rooinaction/course/model"/>

    and then run the following from the roo shell.
    web gwt all --proxyPackage ~.client.proxy --requestPackage ~.client.request

    That doesn't make any difference.

    Can some please tell me how to fix this issue?


  • Sreeni Chippada
    Sorry. I forgot to metion that the application runs fine and displays all the fields except the CourseType filed. The course table does have the course_type filed created.


    Leave a comment: