You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Paul Glezen <pg...@us.ibm.com> on 2005/08/16 18:05:44 UTC

Message: no WRITABLE property





Hi Folks,

I'm having trouble with a query for a Product class that has an attribute
named "pNoticeComanyNumber."

--------- Begin Error Message ----------
12:11:34:895 ERROR ibatis.IbatisProductMaintenance - SQL error:
--- The error occurred in productMap.xml.
--- The error occurred while applying a result map.
--- Check the Product.getProductResult.
--- The error happened while setting a property on the result object.
--- Cause: com.ibatis.common.beans.ProbeException: There is no WRITEABLE
property named 'pNoticeCompanyNo' in class 'xyz.ProductEntityBean'
--------- End Error Message ------------

I've checked to verify the attribute exists and is indeed writable (a
public setter exists).  Of about 20 attributes, four of them have capitals
in the second letter.  And it's only these four attributes that give me
grief.  If I don't include these attributes in my result map, my query
works fine.

I tried changing the name from "pNoticeCompanyNo" to "pnoticedCompanyNo"
(along with the gettings/setters).  My error message changes to:

--------- Begin Error Message ----------
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in productMap.xml.
--- The error occurred while applying a result map.
--- Check the Product.getProductResult.
--- The error happened while setting a property on the result object.
--- Cause: com.ibatis.common.exception.NestedRuntimeException: Error
setting properties of 'xyz.ProductEntityBean@7f8df96d'.  Cause:
java.lang.NullPointerException
Caused by: java.lang.NullPointerException
      at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
      at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:104)
      at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:561)
      at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:536)
      at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:93)
      at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:70)
--------- End Error Message ------------

Here is a snippet from my result map.

<result property="pnoticeCompanyNo" column="P_NOTICE_COMPANY_NO" javaType=
"long" jdbcType="INTEGER"/>

I get the error whether or not I include the javaType or jdbcTypes
attribues.  I wish the error message would indicate which property is
giving trouble.  It took a lot of trial and error to determine it was
stumbling on the pNoticeCompanyNo attribute.

My environment is:

iBatis:  Build Date: 2005/07/17 20:58
         Build Number: 582
         2.1.5 - July 17, 2005

DB:      Oracle 9i
JVM:     IBM 1.4.2
OS:      WinXP

Paul

Re: Message: no WRITABLE property

Posted by Larry Meadors <la...@gmail.com>.
I think that a getter named getpNoticeComanyNumber *should* work,
according the java bean specification.

However, I do not think that it will work with iBATIS, but cannot
confirm this at the moment.

Larry


On 8/16/05, Nathan Maves <Na...@sun.com> wrote:
> Here is the FAQ .....
> 
> http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?pageId=71
> 
> ~N
> On Aug 16, 2005, at 10:23 AM, Aitor Imaz wrote:
> 
> > Hi,
> >
> > I think this question has been brought up before. I can't find the
> > reference now, but I believe the JavaBeans spec doesn't allow
> > having properties with the first two letters capitalized, hence the
> > 'There is no WRITABLE property" error.
> >
> > As for the second error, I'm not sure what's going on. Could you
> > give us more information/code?
> >
> > Aitor
> >
> >
> 
>

Re: Message: no WRITABLE property

Posted by Nathan Maves <Na...@Sun.COM>.
Here is the FAQ .....

http://opensource.atlassian.com/confluence/oss/pages/viewpage.action? 
pageId=71

~N
On Aug 16, 2005, at 10:23 AM, Aitor Imaz wrote:

> Hi,
>
> I think this question has been brought up before. I can't find the  
> reference now, but I believe the JavaBeans spec doesn't allow  
> having properties with the first two letters capitalized, hence the  
> 'There is no WRITABLE property" error.
>
> As for the second error, I'm not sure what's going on. Could you  
> give us more information/code?
>
> Aitor
>
>


Re: Message: no WRITABLE property

Posted by Aitor Imaz <ai...@gmail.com>.
Hi,

I think this question has been brought up before. I can't find the 
reference now, but I believe the JavaBeans spec doesn't allow having 
properties with the first two letters capitalized, hence the 'There is 
no WRITABLE property" error.

As for the second error, I'm not sure what's going on. Could you give 
us more information/code?

Aitor


Re: Message: no WRITABLE property (resolved)

Posted by Paul Glezen <pg...@us.ibm.com>.



Hi Folks.

After following the advice of the responses:

1. Removing capitals from the first two letters of the property name
2. Adding the nullValue attribute in the result map

it works now.  Thanks.

- Paul


Prashanth Sukumaran <pr...@yahoo.com> wrote on 08/16/2005
09:29:50 AM:

> Hi Paul,
>
> make the line
>
> <result property="pnoticeCompanyNo" column="P_NOTICE_COMPANY_NO"
> javaType="long"
> jdbcType="INTEGER"/>
>
> to
>
> <result property="pnoticeCompanyNo" column="P_NOTICE_COMPANY_NO"
> javaType="long"
> jdbcType="INTEGER" nullValue="0"/>
>
>
> This is ridiculous, I know.  I have also wasted so much time on this
> thing before.  But the issue
> is since it is a privimitive type and if the sql returns a NULL it
> throws an nullpointer
> exception.
>
> Rgds
>
> Prashanth Sukumaran.

Re: Message: no WRITABLE property

Posted by Prashanth Sukumaran <pr...@yahoo.com>.
Hi Paul,

make the line

<result property="pnoticeCompanyNo" column="P_NOTICE_COMPANY_NO" javaType="long"
jdbcType="INTEGER"/>

to

<result property="pnoticeCompanyNo" column="P_NOTICE_COMPANY_NO" javaType="long"
jdbcType="INTEGER" nullValue="0"/>


This is ridiculous, I know.  I have also wasted so much time on this thing before.  But the issue
is since it is a privimitive type and if the sql returns a NULL it throws an nullpointer
exception.

Rgds

Prashanth Sukumaran.

--- Paul Glezen <pg...@us.ibm.com> wrote:

> 
> 
> 
> 
> 
> Hi Folks,
> 
> I'm having trouble with a query for a Product class that has an attribute
> named "pNoticeComanyNumber."
> 
> --------- Begin Error Message ----------
> 12:11:34:895 ERROR ibatis.IbatisProductMaintenance - SQL error:
> --- The error occurred in productMap.xml.
> --- The error occurred while applying a result map.
> --- Check the Product.getProductResult.
> --- The error happened while setting a property on the result object.
> --- Cause: com.ibatis.common.beans.ProbeException: There is no WRITEABLE
> property named 'pNoticeCompanyNo' in class 'xyz.ProductEntityBean'
> --------- End Error Message ------------
> 
> I've checked to verify the attribute exists and is indeed writable (a
> public setter exists).  Of about 20 attributes, four of them have capitals
> in the second letter.  And it's only these four attributes that give me
> grief.  If I don't include these attributes in my result map, my query
> works fine.
> 
> I tried changing the name from "pNoticeCompanyNo" to "pnoticedCompanyNo"
> (along with the gettings/setters).  My error message changes to:
> 
> --------- Begin Error Message ----------
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in productMap.xml.
> --- The error occurred while applying a result map.
> --- Check the Product.getProductResult.
> --- The error happened while setting a property on the result object.
> --- Cause: com.ibatis.common.exception.NestedRuntimeException: Error
> setting properties of 'xyz.ProductEntityBean@7f8df96d'.  Cause:
> java.lang.NullPointerException
> Caused by: java.lang.NullPointerException
>       at
>
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
>       at
>
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:104)
>       at
>
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:561)
>       at
>
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:536)
>       at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:93)
>       at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:70)
> --------- End Error Message ------------
> 
> Here is a snippet from my result map.
> 
> <result property="pnoticeCompanyNo" column="P_NOTICE_COMPANY_NO" javaType=
> "long" jdbcType="INTEGER"/>
> 
> I get the error whether or not I include the javaType or jdbcTypes
> attribues.  I wish the error message would indicate which property is
> giving trouble.  It took a lot of trial and error to determine it was
> stumbling on the pNoticeCompanyNo attribute.
> 
> My environment is:
> 
> iBatis:  Build Date: 2005/07/17 20:58
>          Build Number: 582
>          2.1.5 - July 17, 2005
> 
> DB:      Oracle 9i
> JVM:     IBM 1.4.2
> OS:      WinXP
> 
> Paul


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com