Announcement Announcement Module
Collapse
No announcement yet.
BeanPropertySqlParameterSource and Boolean type property handing problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • BeanPropertySqlParameterSource and Boolean type property handing problem

    I am using BeanPropertySqlParameterSource for executing update on JDBC sql.
    My bean has 'active' property of type 'Boolean'. And hence getter method if 'isActive() returning Boolean type.

    But BeanPropertySqlParameterSource is not able to work with 'isActive()' method. I get this exception:
    ============
    org.springframework.dao.InvalidDataAccessApiUsageE xception:
    No value supplied for the SQL parameter 'active':
    Invalid property 'active' of bean class [com.jframeworks.template.entity.config.Configurati onGroup]:
    Bean property 'active' is not readable or has an invalid getter method:
    Does the return type of the getter match the parameter type of the setter?
    =============

    If i change method to getActive, then it works. I have been trying to debug this problem, to find root cause, but getting lost in complexity of PropertyDescriptions and internal caches.
    One thing, I figured out, it's using java.beans package instead of apache common utils.

    Is it bug or I am doing something wrong?

    I am using Spring 3.1.0.M1, MySQL 5.1.x, Accessing DB using simplejdbctemplate object.

  • #2
    Hello

    use code tags

    My bean has 'active' property of type 'Boolean'. And hence getter method if 'isActive() returning Boolean type.
    OK, thats correct about the specification

    org.springframework.dao.InvalidDataAccessApiUsageE xception:
    No value supplied for the SQL parameter 'active':
    Invalid property 'active' of bean class [com.jframeworks.template.entity.config.Configurati onGroup]:
    Bean property 'active' is not readable or has an invalid getter method:
    Does the return type of the getter match the parameter type of the setter?
    If i change method to getActive, then it works.
    Wondered, well for Spring is mandatory find the classic setter/getter methods
    to work in peace, BTW both are not mandatory in the same time, I mean you can have only a setter

    Well is not catastrophic work with the getter instead of the isX() approach

    to find root cause, but getting lost in complexity of PropertyDescriptions and internal caches. One thing, I figured out, it's using java.beans package instead of apache common utils.
    Could you expand the idea?

    Is it bug or I am doing something wrong?
    I don't think so, just use the getter instead

    Let me know your thoughts

    Comment


    • #3
      Thanks for reply!!
      But I am still trying to figure out, whether it is defect on "BeanPropertySqlParameterSource " or more specifically, 'BeanWrapperImpl' class. Yes, I can use getXXX method for boolean, but would like to keep my code close to specs.
      If it is defect, then I should open defect in jira for it.. hopefully, get addressed in upcoming releases.

      Comment


      • #4
        One more thing, I noticed, any specific reason, Spring API is not using apache commons beans package. I debugged spring api.. it's complex at it;s best, trying to figure out nested properties logic etc.

        Comment


        • #5
          Hello

          You should wait an official answer from the Spring's developers team, a JIRA could be an option too here

          I cant help you here, I understand your point about to keep the specifications

          Comment

          Working...
          X