cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Haul <>
Subject Re: DatabaseAction
Date Mon, 11 Feb 2002 09:16:25 GMT
On 08.Feb.2002 -- 11:29 AM, Malte Vahlenkamp wrote:
> First of all thanks for your help.
> Maybe I got something wrong, but this still doesn't work out for me. now I have tried
the following mapping but the behavior is the same: Insert works well for the first table
but fails for the second table due to a null value in projectid.
> <table name="PROJECTS">
>     <keys>
>       		<key param="ProjectId" dbcol="projectid" type="int" mode="manual"/>
>     </keys>
>     <values>
>       <value param="ProjectName" dbcol="projectname" type="string"/>
>       <value param="UserId" dbcol="userid" type="string"/>
>     </values>  		                      	              
>   </table>
>   <table name="USERPROJECTS">	    	      		    
>     <keys>      		
>     	<key param="ProjectId" request-attribute-name="org.apache.cocoon.acting.AbstractDatabaseAction:ProjectId"
dbcol="projectid" type="int" mode="request-attribute"/>
>     </keys>
>     <values>      	      					    	
>     	<value param="UserId" dbcol="userid" type="int"/>
>     </values>    
>   </table>      
> Any comments are appreciated.


it looks like my advice was wrong (should have had a closer look at
the source): DatabaseAddAction takes care of the correct prefix

Quoting the source (DatabaseAddAction.setKey):

     * This method has a couple of side effects. If the mode is manual,
     * the key value is stored in the request object's attributes for use
     * by other inserts. The key is the string "key:TABLENAME:DBCOL".
     * This method also puts the value of manually created keys in the results
     * map. That key is simply the value of the dbcol attribute. Note this
     * stuff is definitely up in the air.


     <key param="ProjectId" request-attribute-name="key:PROJECTS.projectid" dbcol="projectid"
type="int" mode="request-attribute"/>

is what you want to use.

If this doesn't work, please have a look at the request attributes
that were set by the action by putting
<xsp-request:get-attribute-names/> on your XSP and post the
result. Maybe there's an issue with cases.


C h r i s t i a n       H a u l
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

To unsubscribe, e-mail:
For additional commands, email:

View raw message