Results 1 to 5 of 5

Thread: BeanPropertySqlParameterSource and Boolean type property handing problem

  1. #1
    Join Date
    Jan 2008
    Location
    NJ, USA
    Posts
    14

    Question 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. #2
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    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
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  3. #3
    Join Date
    Jan 2008
    Location
    NJ, USA
    Posts
    14

    Default

    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.

  4. #4
    Join Date
    Jan 2008
    Location
    NJ, USA
    Posts
    14

    Default

    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.

  5. #5
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    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
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •