Trying to follow the JavaBeans spec with wierd property names is a bit of a
black art.  This test case shows what Abator is doing now:

http://svn.apache.org/repos/asf/ibatis/trunk/java/mapper/mapper2/tools/abator/core/test/org/apache/ibatis/abator/internal/util/JavaBeansUtilTests.java

I think this is right!  But if you catch something wrong, I'd be happy to
hear about it.

In the fixed Abator, l_state would turn into property "LState" with
"getLState" and "setLState" methods.

Jeff Butler


On 4/2/07, Antony Stubbs <[EMAIL PROTECTED]> wrote:


Good news.

Is it this  http://issues.apache.org/jira/browse/IBATIS-370 issue ? It's
marked as invalid. So we have to work with this?

"This isn't a bug - it is a peculiarity in the Javabeans spec. It turns
out
that it is impossible to have a property with only the first letter being
lower case. You must specify the property as "XAxis"."


Jeff Butler-2 wrote:
>
> There is a bug in Abator 1.0 releted to this.  The bug has fixed in SVN
> for
> some time, so if you
> download the new source build it yourself things will be better.
>
> Jeff Butler
>
>
> On 4/2/07, Antony Stubbs <[EMAIL PROTECTED]> wrote:
>>
>>
>> Yes I agree. My properties *were* myProperty format, not MyProperty -
as
>> Abator generates them.
>>
>> The problem I've found, is that for *every* table in my dB that
contains
>> a
>> column name of the pattern x_yyyy...  (ie. where the first letter is
>> lowercase and followed by an underscore), iBatis fails, complaining as
>> per
>> below that no property exists called xYyyy... It kicks a fit around
>> looking
>> for the setter method.
>>
>> What I was showing, was that a work around, is to override the property
>> name
>> to XYyyy... Then iBatis stops complaining.
>>
>> Further note:
>> Same problem with column name:
>> L_state
>> l_State
>> L_State
>>
>> problem fixed with column name:
>> ll_state
>>
>> Just to be clear - simply changing the column name from l_state to
>> ll_state
>> in my db and re-generating the abator artefacts fixes the problem. But
I
>> don't want to change my scheme, and the work arounds below do seem to
>> work
>> for now, but this does seem to be a problem.
>>
>>
>> Daniel Pitts wrote:
>> >
>> > Its my understanding that you're property name should start with a
>> > lowercass letter, not an uppercase letter.
>> > getMyProperty() will get the "myProperty" property.  There is no
>> > "MyProperty", and no way to create one, short of implementing a
>> BeanInfo
>> > class.  Who wants to do that? And I don't think iBATIS supports
>> standard
>> > bean introspection, so a BeanInfo class isn't going to help in this
>> > case.
>> >
>> >
>> > ________________________________
>> >
>> >       From: Antony Stubbs [mailto:[EMAIL PROTECTED]
>> >       Sent: Monday, April 02, 2007 4:53 PM
>> >       To: [email protected]
>> >       Subject: No writeable property in class. Bug? Strange work
>> > arounds.
>> >
>> >
>> >
>> >       I think I have a similar problem to this thread
>> >
>> <
http://www.nabble.com/There-is-no-WRITEABLE-property-called-%27UserId%2
>> > 7-in-AppUser-tf1404646.html#a3789203> .
>> >
>> >       I have some columns named c_value, l_state etc in the db (I
>> > can't change the scheme) and the abator generated code complains that
>> > "There is no WRITEABLE property named 'cValue' in class
>> > 'com.fonterra.tams.orm.abator.model.TankerLog'", when in fact there
is.
>> >
>> >       Two things seem to fix this - either using
>> >       columnOverride column="l_state" property="LState"
>> >
>> >       or
>> >
>> >       Setting useActualColumnNames to *true* for each table that has
>> > this problem.
>> >
>> >       or
>> >
>> >       Renaming the db column simply to double the first lower case
>> > letter (e.g. ll_state instead of l_state).
>> >
>> >       I'd prefer not to have to do either.
>> >
>> >       Any ideas?
>> >       Caused by: java.lang.RuntimeException: Error initialising
>> > BaseIbatisDao class. Cause: java.lang.RuntimeException: Error
occurred.
>> > Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.
>> > Cause: java.lang.RuntimeException: Error parsing XPath
>> > '/sqlMapConfig/sqlMap'.  Cause:
com.ibatis.common.xml.NodeletException:
>> > Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing
>> > XPath '/sqlMap/resultMap/result'.  Cause:
>> > com.ibatis.common.beans.ProbeException: There is no WRITEABLE
property
>> > named 'cValue' in class 'com.fonterra.tams.orm.abator.model.TankerLog
'
>> >       tanker_log_SqlMap.xml
>> > <http://www.nabble.com/file/7622/tanker_log_SqlMap.xml>
TankerLog.java
>> > <http://www.nabble.com/file/7623/TankerLog.java> TruckTDAOImpl.java
>> > <http://www.nabble.com/file/7624/TruckTDAOImpl.java>
>> >                       table schema="tams" tableName="tanker_log"
>> > modelType="flat"
>> >                               columnOverride column="l_state"
>> > property="LState"/
>> >                               columnOverride column="a_min"
>> > property="AMin"/
>> >                       /table
>> >       DROP TABLE IF EXISTS `tams`.`tanker_log`;
>> >       CREATE TABLE  `tams`.`tanker_log` (
>> >         `tanker_header_id` int(10) unsigned NOT NULL auto_increment,
>> >         `tanker_message_id` int(10) unsigned NOT NULL default '0',
>> >         `variable_id` int(10) unsigned NOT NULL default '0',
>> >         `sample_timestamp` int(10) unsigned NOT NULL default '0',
>> >         `l_state` varchar(3) NOT NULL default '',
>> >         `cc_value` int(10) unsigned NOT NULL default '0',
>> >         `a_min` int(10) unsigned NOT NULL default '0',
>> >         `a_max` int(10) unsigned NOT NULL default '0',
>> >         `a_avg` int(10) unsigned NOT NULL default '0',
>> >         `a_snapshot` int(10) unsigned NOT NULL default '0',
>> >         `a_in_greenband` varchar(3) NOT NULL default '',
>> >         `a_in_greenband_duration` int(10) unsigned NOT NULL default
>> > '0',
>> >         PRIMARY KEY
>> >
>>
(`tanker_header_id`,`tanker_message_id`,`variable_id`,`sample_timestamp`
>> > )
>> >       ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
>> >
>> > ________________________________
>> >
>> >       View this message in context: No writeable property in class.
>> > Bug? Strange work arounds.
>> >
>> <
http://www.nabble.com/No-writeable-property-in-class.-Bug--Strange-work
>> > -arounds.-tf3508972.html#a9801228>
>> >       Sent from the iBATIS - User - Java mailing list archive
>> > <http://www.nabble.com/iBATIS---User---Java-f370.html>  at Nabble.com
.
>> >
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>>
http://www.nabble.com/No-writeable-property-in-class.-Bug--Strange-work-arounds.-tf3508972.html#a9801546
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>
>

--
View this message in context:
http://www.nabble.com/No-writeable-property-in-class.-Bug--Strange-work-arounds.-tf3508972.html#a9802836
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Reply via email to