You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Johannes Hoechstaedter <j....@memocomp.de> on 2008/06/19 12:38:54 UTC
DatabaseAddAction
Hie evrybody,
I have some questions about the DatabaseAddAction. I want to use it, but
I am not sure about the autoincrement parameter. Because of this I don't
want to use an autoincrement at first.
My database descriptor looks like this:
<?xml version="1.0"?>
<!-- Decriptor file for USER from Scarab DB -->
<root>
<connection>personnel</connection>
<table name = "USER" alias="USER">
<title>
Welcome to edit USER!
</title>
<description>
Try description
</description>
<keys>
<key name="user_id" alias="User Id (PK)" access="h" delim=","
type="int">
</key>
</keys>
<values deleteable = "true">
<value access="r" delim="," name="login_name" alias="Login
Name" type="string">
</value>
<value access="r" delim="," name="password_value" alias="PWD"
type="string">
</value>
<value access="r" delim="," name="last_name" alias="Last Name"
type="string">
</value>
<value access="r" delim="no" name="first_name" alias="First
Name" type="string">
</value>
</values>
</table>
</root>
Not all columns from the db are listed, but all which has to be defined
(all not-null-columns).
When I do an add action I get an NullPointerException in
DatabaseAction.getColumnValue() and DatabseAddAction.getColumnValues().
When I look into the log file I see:
2008-06-19 12:15:00,562 btpool0-1 DEBUG modular.DatabaseAddAction -
Trying to set column USER.user_id from manual using getAttribute method
2008-06-19 12:15:00,562 btpool0-1 DEBUG modular.DatabaseAddAction -
Rolling back transaction. Caused by null
So I thought the action has not found the value of the my primary key
user_id in the request. But when I look into my requets, there is an
attribute USER.user_id=130.
Any suggestions? Whats the purpose of: Trying to set column USER.user_id
from manual using getAttribute method ?
cheers
Johannes
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: DatabaseAddAction
Posted by Johannes Hoechstaedter <j....@memocomp.de>.
Now I have edited the keys section:
<keys>
<key name="user_id" alias="User Id (PK)" access="h" delim=","
type="int">
<mode name="request" type="all">
<parameter>USER.user_id</parameter>
</mode>
</key>
</keys>
The current log is:
...
2008-06-19 14:14:36,812 btpool0-1 DEBUG modular.DatabaseAddAction -
Trying to set column USER.user_id from request using getAttribute method
2008-06-19 14:14:36,812 btpool0-1 DEBUG modular.DatabaseAddAction -
Setting column USER.user_id [0] null
2008-06-19 14:14:36,812 btpool0-1 DEBUG
support.DefaultListableBeanFactory - Returning cached instance of
singleton bean
'org.apache.cocoon.components.modules.input.InputModuleSelector'
2008-06-19 14:14:36,812 btpool0-1 DEBUG
support.DefaultListableBeanFactory - Returning cached instance of
singleton bean
'org.apache.cocoon.components.modules.input.InputModule/request-param'
2008-06-19 14:14:36,812 btpool0-1 DEBUG modular.DatabaseAddAction -
Trying to set column USER.login_name from request-param using
getAttribute method
2008-06-19 14:14:36,812 btpool0-1 DEBUG modular.DatabaseAddAction -
Setting column USER.login_name [0] login_name
...
and so on
why does the getAttribute method doesn't fetch the value from user_id
but from login_name? The URL is:
http://...USER/2?submit=Add&USER.user_id=130&USER.login_name=login_name&...
Johannes Hoechstaedter schrieb:
> Hie evrybody,
>
> I have some questions about the DatabaseAddAction. I want to use it,
> but I am not sure about the autoincrement parameter. Because of this I
> don't want to use an autoincrement at first.
>
> My database descriptor looks like this:
>
> <?xml version="1.0"?>
> <!-- Decriptor file for USER from Scarab DB -->
> <root>
> <connection>personnel</connection>
> <table name = "USER" alias="USER">
> <title>
> Welcome to edit USER!
> </title>
> <description>
> Try description
> </description>
> <keys>
> <key name="user_id" alias="User Id (PK)" access="h" delim=","
> type="int">
> </key>
> </keys>
> <values deleteable = "true">
> <value access="r" delim="," name="login_name" alias="Login
> Name" type="string">
> </value>
> <value access="r" delim="," name="password_value"
> alias="PWD" type="string">
> </value>
> <value access="r" delim="," name="last_name" alias="Last Name"
> type="string">
> </value>
> <value access="r" delim="no" name="first_name" alias="First
> Name" type="string">
> </value>
> </values> </table>
>
> </root>
>
> Not all columns from the db are listed, but all which has to be
> defined (all not-null-columns).
>
> When I do an add action I get an NullPointerException in
> DatabaseAction.getColumnValue() and DatabseAddAction.getColumnValues().
>
> When I look into the log file I see:
>
> 2008-06-19 12:15:00,562 btpool0-1 DEBUG modular.DatabaseAddAction -
> Trying to set column USER.user_id from manual using getAttribute method
> 2008-06-19 12:15:00,562 btpool0-1 DEBUG modular.DatabaseAddAction -
> Rolling back transaction. Caused by null
>
> So I thought the action has not found the value of the my primary key
> user_id in the request. But when I look into my requets, there is an
> attribute USER.user_id=130.
>
> Any suggestions? Whats the purpose of: Trying to set column
> USER.user_id from manual using getAttribute method ?
>
> cheers
> Johannes
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org