You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Ruy Diaz Jara <di...@yahoo.com> on 2004/11/25 01:33:27 UTC
Problem with doDelete (null pointer)
Hi all,
The strangest thing is happening. I am having trouble deleting from one of my
tables, upon calling doDelete(), I receive a null pointer Exception:
java.lang.NullPointerException
at org.apache.torque.util.BasePeer.doDelete(BasePeer.java:530)
at org.apache.torque.util.BasePeer.doDelete(BasePeer.java:446)
at
com.ericsson.esb.sms.om.BaseKeyword2Peer.doDelete(BaseKeyword2Peer.java:505)
[...]
I've checked out BasePeer's source code, and line 530 is:
ColumnMap[] columnMaps = dbMap.getTable(tab).getColumns();
Looking around, on some other post, someone mentions the problem and said that
they had to modify Torque's source because somehow the map was becoming null,
so he manually initialized dbMap every time it was called in the code :o .
Still, this solution doesn't sound right, given how well Torque normally works.
On some other post
(http://wiki.apache.org/db-torque/FrequentlyAskedQuestions#head-741b057263b7493fb0461d011753bc01d5967742)
I read that certain exceptions could arise from trying to delete records from a
table with no primary key. I thought this was it (my table had no primary key),
however, I after including a primary key I am still getting the same error.
I am attaching the table schema:
<table name="keyword2" idMethod="native">
<column name="ID" type="INTEGER" size="11" required="true" primaryKey="true"
autoIncrement="true"/>
<column name="KEYWORD" type="VARCHAR" size="160" required="true"/>
<column name="CONTENT" type="VARCHAR" size="255" default=""/>
<column name="PARAM" type="VARCHAR" size="255" default=""/>
<column name="COMMMETHOD" required="true" type="VARCHAR" size="30" />
<unique>
<unique-column name="KEYWORD"/>
<unique-column name="COMMMETHOD"/>
</unique>
</table>
I am using Torque 3.1 and MySQL 4.0.18 (using them under Jetspeed 1.5, but I
don't think this has anything to do with it). The strange part is that I can do
Selects and Inserts on this table with no problem, and I can do Deletes on all
my other tables as well... Any hints?
Regards
Ruy
__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org
Re: Problem with doDelete (null pointer)
Posted by Ruy Diaz Jara <di...@yahoo.com>.
Solved it. I had to add a 'name' attribute to the schema. This is because I am
using two DBs, and the default db points to the other one. I added the name to
this other schema and things work now.
Regards
Ruy
--- Ruy Diaz Jara <di...@yahoo.com> wrote:
> Hi all,
>
> The strangest thing is happening. I am having trouble deleting from one of my
> tables, upon calling doDelete(), I receive a null pointer Exception:
>
> java.lang.NullPointerException
> at org.apache.torque.util.BasePeer.doDelete(BasePeer.java:530)
> at org.apache.torque.util.BasePeer.doDelete(BasePeer.java:446)
> at
> com.ericsson.esb.sms.om.BaseKeyword2Peer.doDelete(BaseKeyword2Peer.java:505)
> [...]
>
> I've checked out BasePeer's source code, and line 530 is:
>
> ColumnMap[] columnMaps = dbMap.getTable(tab).getColumns();
>
>
> Looking around, on some other post, someone mentions the problem and said
> that
> they had to modify Torque's source because somehow the map was becoming null,
> so he manually initialized dbMap every time it was called in the code :o .
> Still, this solution doesn't sound right, given how well Torque normally
> works.
> On some other post
>
(http://wiki.apache.org/db-torque/FrequentlyAskedQuestions#head-741b057263b7493fb0461d011753bc01d5967742)
> I read that certain exceptions could arise from trying to delete records from
> a
> table with no primary key. I thought this was it (my table had no primary
> key),
> however, I after including a primary key I am still getting the same error.
>
> I am attaching the table schema:
>
> <table name="keyword2" idMethod="native">
> <column name="ID" type="INTEGER" size="11" required="true"
> primaryKey="true"
> autoIncrement="true"/>
> <column name="KEYWORD" type="VARCHAR" size="160" required="true"/>
> <column name="CONTENT" type="VARCHAR" size="255" default=""/>
> <column name="PARAM" type="VARCHAR" size="255" default=""/>
> <column name="COMMMETHOD" required="true" type="VARCHAR" size="30" />
> <unique>
> <unique-column name="KEYWORD"/>
> <unique-column name="COMMMETHOD"/>
> </unique>
> </table>
>
> I am using Torque 3.1 and MySQL 4.0.18 (using them under Jetspeed 1.5, but I
> don't think this has anything to do with it). The strange part is that I can
> do
> Selects and Inserts on this table with no problem, and I can do Deletes on
> all
> my other tables as well... Any hints?
>
> Regards
> Ruy
>
>
>
> __________________________________
> Do you Yahoo!?
> Meet the all-new My Yahoo! - Try it today!
> http://my.yahoo.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>
=====
-------------------------------
I used to be an atheist, until I realized I was God.
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org