Announcement Announcement Module
Collapse
No announcement yet.
Bean property not readable Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bean property not readable

    I have the java 1.5 (jrockit) and created a very simple class:
    Code:
    @Entity
    @RooJavaBean
    @RooToString
    @RooEntity(finders = { "findSingleNamesByRefEntIDEquals" })
    public class SingleName {
    
        private Integer RefEntID;
    
        private String RefEntName;
    }
    All the Roo tests pass but when I'm trying to access http://localhost:8080/dtcc/singlename/form to create a new entry I get the following error;
    Code:
    Added model object 'singlename' of type [au.gov.rba.dtcc.domain.SingleName] to request in view with name 'singlename/create'
    Added model object 'org.springframework.validation.BindingResult.singlename' of type [org.springframework.validation.BeanPropertyBindingResult] to request in view with name 'singlename/create'
    Invalid property 'RefEntID' of bean class [au.gov.rba.dtcc.domain.SingleName]: Bean property 'RefEntID' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    org.springframework.beans.NotReadablePropertyException: Invalid property 'RefEntID' of bean class [au.gov.rba.dtcc.domain.SingleName]: Bean property 'RefEntID' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    It's a bit strange to me that all the Roo generated test (9) pass but you can still get such an elementary error in the webapp.

    Any suggestions would be appreciated. Thanks.

    This is the SingleName.aj:

    Code:
    privileged aspect SingleName_Roo_JavaBean {
        
        public Integer SingleName.getRefEntID() {    
            return this.RefEntID;        
        }    
        
        public void SingleName.setRefEntID(Integer RefEntID) {    
            this.RefEntID = RefEntID;        
        }    
        
        public String SingleName.getRefEntName() {    
            return this.RefEntName;        
        }    
        
        public void SingleName.setRefEntName(String RefEntName) {    
            this.RefEntName = RefEntName;        
        }    
        
    }

  • #2
    This looks like https://jira.springsource.org/browse/ROO-303 to me.

    Comment


    • #3
      Thanks. Switching to lower case fixed it indeed. Having bean fields start in lower case is a pretty standard practice in java, I was just copying fields from an existing database. Perhaps there could be a validator in Roo on the fields that would enforce it.

      Comment


      • #4
        I've made a note to refer to the field name issue in the documentation. iven Roo can't stop you from editing the Java source and making a field uppercase, it makes more sense to explain to the users the JavaBean field convention and also ensure Roo doesn't break should the user violate it (Roo rejecting an uppercase-containing field would be considered a bug and we would fix it).

        Comment

        Working...
        X