ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oliverw <oli...@weichhold.com>
Subject Re: Auxiliary insert parameter
Date Fri, 15 Feb 2008 13:07:06 GMT

Interesting. I didn't know that IBatis will happily resolve nested property
identifiers. Thanks! I'll give this a a shot.


Dave.Derry wrote:
> 
> I'm no pro with ibatis, but you could probably use a Map
> 
> Map<String, Object> params = new HashMap<String, Object>();
> params.put("itemName", [instance of ItemName]);
> params.put("ts_config", [value of ts_config]);
> 
> then modify your insert statement
> 
> <insert id="insertItemName" parameterClass="map" >
>   INSERT INTO item_names (item_id, item_name, item_name_tsv, culture_id)
> VALUES(#itemName.item_id#, #itemName.item_name#, to_tsvector(#ts_config#,
> #itemName.item_name#),
> #itemName.culture_id# )
> </insert>
> 
> 
> I think this should work for you.
> 
> Dave
> 
> We must begin not just to act, but to think, for there is no better slave
> than the one who believes his slavery to be freedom, and we are in
> no greater peril than when we cannot see the chains on our minds
> because there are yet no chains on our feet.
> -- Michael Reid
> 
> 
> 
> 
>                                                                            
>              oliverw                                                       
>              <oliver@weichhold                                             
>              .com>                                                      To 
>                                        user-java@ibatis.apache.org         
>              02/15/2008 07:01                                           cc 
>              AM                                                            
>                                                                    Subject 
>                                        Auxiliary insert parameter          
>              Please respond to                                             
>              user-java@ibatis.                                             
>                 apache.org                                                 
>                                                                            
>                                                                            
>                                                                            
> 
> 
> 
> 
> 
> <insert id="insertItemName" parameterClass="com.foo.bar.model.ItemName" >
>   INSERT INTO item_names (item_id, item_name, item_name_tsv, culture_id)
> VALUES(#item_id#, #item_name#, to_tsvector(#ts_config#, #item_name#),
> #culture_id# )
> </insert>
> 
> In the above insert statement the #ts_config# is only needed as an
> argument
> to the to_tsvector() function call. Thus I would like to avoid making
> ts_config a member of the ItemName bean.
> 
> Unfortunately I am not sure how to pass the value of #ts_config# in
> addition
> to the ItemName object to the insert statement. Any suggestions?
> --
> View this message in context:
> http://www.nabble.com/Auxiliary-insert-parameter-tp15499629p15499629.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Auxiliary-insert-parameter-tp15499629p15500657.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message