You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Warner Onstine <wa...@warneronstine.com> on 2001/06/30 06:48:34 UTC

error when trying to save through OM object

Hi all,
Finally worked through some of the setup stuff and have run into a new
problem and was hoping for some help.

I have generated some OM classes using torque and have set everything up in
my Action (which extends VelocityAction) to use a particular OM called
Project.

Now the Action gets called correctly. I can retrieve the field which I am
referencing on the form now here is where I hit the snag:

        Project project = new Project();
            try {
                project.setName(projectName);
                project.save("story");
            } catch (Exception e) {
                e.printStackTrace();
                data.setMessage("Error while saving :: " + e.toString());
                throw new Exception("Error while attempting to save.");
            }

Now "story" is the database (which is also referenced in the
TurbineResources.properties file). What happens is the Exception gets caught
and it is a
NullPointerException
        at
org.apache.turbine.om.peer.BasePeer.rollBackTransaction(BasePeer.java:366)
        at com.warneronstine.story.om.BaseProject.save(BaseProject.java:423)
        at
com.warneronstine.story.actions.AddProject.doInsert(AddProject.java:36)
        at java.lang.reflect.Method.invoke(Native Method)
        at
org.apache.turbine.util.velocity.VelocityActionEvent.executeEvents(VelocityA
ctionEvent.java:166)
        at
org.apache.turbine.util.velocity.VelocityActionEvent.perform(VelocityActionE
vent.java:114)

Any ideas on what I am doing incorrectly?

Turbine 2.1
Torque 2.1
Velocity 1.2-dev
mysql 2.0.4

Running on Tomcat 4.0b5
Mysql 3.23.36
all on Win2k pro

Thanks in advance, please let me know if I left anything out.

-warner


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: error when trying to save through OM object

Posted by Warner Onstine <wa...@warneronstine.com>.
Sorry, reposting to turbine-users. Oops!

-warner

----- Original Message -----
From: "Warner Onstine" <wa...@warneronstine.com>
To: <tu...@jakarta.apache.org>
Sent: Friday, June 29, 2001 9:48 PM
Subject: error when trying to save through OM object


> Hi all,
> Finally worked through some of the setup stuff and have run into a new
> problem and was hoping for some help.
>
> I have generated some OM classes using torque and have set everything up
in
> my Action (which extends VelocityAction) to use a particular OM called
> Project.
>
> Now the Action gets called correctly. I can retrieve the field which I am
> referencing on the form now here is where I hit the snag:
>
>         Project project = new Project();
>             try {
>                 project.setName(projectName);
>                 project.save("story");
>             } catch (Exception e) {
>                 e.printStackTrace();
>                 data.setMessage("Error while saving :: " + e.toString());
>                 throw new Exception("Error while attempting to save.");
>             }
>
> Now "story" is the database (which is also referenced in the
> TurbineResources.properties file). What happens is the Exception gets
caught
> and it is a
> NullPointerException
>         at
> org.apache.turbine.om.peer.BasePeer.rollBackTransaction(BasePeer.java:366)
>         at
com.warneronstine.story.om.BaseProject.save(BaseProject.java:423)
>         at
> com.warneronstine.story.actions.AddProject.doInsert(AddProject.java:36)
>         at java.lang.reflect.Method.invoke(Native Method)
>         at
>
org.apache.turbine.util.velocity.VelocityActionEvent.executeEvents(VelocityA
> ctionEvent.java:166)
>         at
>
org.apache.turbine.util.velocity.VelocityActionEvent.perform(VelocityActionE
> vent.java:114)
>
> Any ideas on what I am doing incorrectly?
>
> Turbine 2.1
> Torque 2.1
> Velocity 1.2-dev
> mysql 2.0.4
>
> Running on Tomcat 4.0b5
> Mysql 3.23.36
> all on Win2k pro
>
> Thanks in advance, please let me know if I left anything out.
>
> -warner
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org