ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Moss <dav...@graticule.com>
Subject Re: how can i get attribute from inbed object?
Date Fri, 02 Dec 2005 09:45:08 GMT
Thanks for the replys,

I think that the problem is probably because the projection object in my 
IFeatureSet implementation has not been initialised, although I would 
expect a NullPointerException to be thrown rather than 
BadSqlGrammarException.  The SqlMap is valid so iBATIS doesn't throw an 
exception when its parsed, but when the property is actually read I 
think it's getting null returned as the parameter property, and hence 
the name property of parameter doesn't exist.

Thanks for the help anyway...

Dave.


> Dave,
>
> Can you also give us the parameter class code?  Without more  
> information on this class there is no way to tell.
>
> Nathan
> On Dec 1, 2005, at 10:26 AM, David Moss wrote:
>
>> Hi,
>>
>> Has anyone managed to get this to work?
>>
>> I'm trying to do something very similar, but it's not working.
>>
>> I have a class IProjection with a property name.  If I try the  
>> following map
>>
>> <insert id="storeFeatureSet" parameterClass="IFeatureSet">
>>
>>    insert into feature_set (format_id, projection_name, bounds)
>>    values(#format.id#,
>>    #projection.name#,
>>    box3d('BOX3D($bounds.minX$ $bounds.minY$, $bounds.maxX$
>>    $bounds.maxY$)'))
>>
>> </insert>
>>
>> I get an error 'BadSqlGrammarException - Check the parameter  mapping 
>> for the 'projection.name' property.'
>>
>> So..., the 'name' property may be incorrect, but it's not.  iBATIS  
>> throws an error long before getting this far if the property name  is 
>> invalid.
>>
>> I can't work out what's wrong.
>> (Interestingly, I assume it has happily parsed #format.id#!)
>>
>> Doesn't anyone have any insights?
>>
>> Thanks. Dave.
>>
>>
>>
>>> Hi, Clinton
>>>     Would you please take a look at following message? i could not  
>>> find any clues from ibatis example and docs.
>>> Does #handleby.id# will be treated as getHandleby().getId()?
>>> IF not, then, how can i create an Account with handleby User  
>>> specified?
>>> Must i try insert and update at the same time?
>>>  regards,
>>> alex
>>>  On 11/19/05, *Alex Chew* <chew.alex@gmail.com  
>>> <mailto:chew.alex@gmail.com>> wrote:
>>>
>>>      Hi, all
>>>      would you please help me for following issue, thanks advance.
>>>
>>>      POJO:
>>>     public class Account implements Serializable {
>>>      private Long id;
>>>      private String name;
>>>     private Double deposit;
>>>      private User handleby;
>>>     }
>>>      public class User implements Serializable {
>>>      private Long id;
>>>      private String username;
>>>     private String password;
>>>     }
>>>
>>>      SQL:
>>>      <insert id=3D"insertAccount" parameterClass=3D"account">
>>>     insert into ACCOUNT (ID,NAME, DEPOSITE, FK_HANDLEBY)
>>>     values (#id#, #name#, #deposit#, #handleby.id#)
>>>     </insert>
>>>
>>>     *handleby.id <http://handleby.id/>* cannot work,the value  inserted
>>>     is NULL, and no other excpetion message.
>>>     Must i get id of handleby
>>>     User manually?
>>>
>>>     regards
>>>     Alex
>>>
>

Mime
View raw message