Hi,
yes that's true. I tried to store the object in the way described
in the Peers Howto. That didn't work. So I looked in the
Base<TableName>Peer.java and the Base<TableName>.java files.
The explanation for the method doInsert() was '/**Method to do
inserts*/'.
save() is for 'storing the object in the database'. I just wanted to be
sure
not to get the answer: take the save() method or take the doInsert()
method.
Thanks a lot to Pete and Fabian for the instructions and the tutorial!
Stefan
Heiko Braun wrote:
>
> Hi,
>
> i dont have a concrete answer, but i was
> wondering about your code. Isn't it redundent to
> first call doInsert() manually and afterwards call save()
> (which then starts the transaction) ?
>
> Hope that helps,
>
> Heiko
>
> On Sat, 19 Jan 2002 19:26:26 +0100
> Stefan Krause <[EMAIL PROTECTED]> wrote:
>
> | Hi,
> |
> | I use torque in the stand-alone version and I try to insert data into a
> | database table.
> | I use mysql. The peer classes are created. I compiled my test class
> | "DBTest" succesfully.
> | My database table to insert exists and is called "Contributor".
> | Here is the code:
> |
> | package org.openscience.nmrshiftdb;
> |
> | public class DBTest
> | {
> | public static void main(String args[])
> | {
> | Contributor con = new Contributor();
> | con.setFirstName("name");
> | con.setLastName("name");
> | con.setZipCode(1234);
> | try
> | {
> | ContributorPeer.doInsert(con);
> | con.save();
> | }
> | catch (Exception exc)
> | {
> | }
> | }
> | }
> |
> | When I do run I get the following exception:
> |
> | run:
> | [java] Exception in thread "main"
> | java.lang.ExceptionInInitializerError: java.lang.NullPointerException
> | [java] at
> | org.apache.torque.util.BasePeer.getMapBuilder(BasePeer.java:1922)
> | [java] at
> |
>org.opensience.nmrshiftdb.BaseContributorPeer.<clinit>(BaseContributorPeer.java:29)
> | [java] at org.opensience.nmrshiftdb.DBTest.main(DBTest.java:36)
> | [java] Java Result: 1
> |
> | Is it because it can't find the BasePeer class?
> | I would be grateful for an advice.
> | Thanks in advance.
> |
> | Stefan
> |
> | --
> | To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> | For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> |
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>