ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave.De...@Equifax.com
Subject Re: Auxiliary insert parameter
Date Fri, 15 Feb 2008 12:23:35 GMT
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.culture_id# )

I think this should work for you.


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

             .com>                                                      To 
             02/15/2008 07:01                                           cc 
                                       Auxiliary insert parameter          
             Please respond to                                             

<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# )

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
to the ItemName object to the insert statement. Any suggestions?
View this message in context:
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

View raw message