On Mon, Jan 14, 2002 at 04:11:45PM -0500, Joseph Edward Boniakowski wrote:
> I wrote a simple Test class:
> public class Test{
>  public static void main(String[] args){
>   try{
>    Torque.init("Torque.properties");
>    Civilization c =  new Civilization();
>    c.setName("Babel");
>    c.save();
>   } catch(Exception e){
>
> [snip]
> 
> If I do have it in the classpath ("mm.mysql-2.0.7-bin.jar"), I get a null
> pointer exception from BasePeer line 765.  At this line, there's code like
> this:
> 
>         DatabaseMap dbMap = Torque.getDatabaseMap( criteria.getDbName() );
>         System.out.println("dbMap: " + dbMap);
>         TableMap tableMap = dbMap.getTable(tableName);
>         System.out.println("tableMap: " +tableMap);
>         Object keyInfo = tableMap.getPrimaryKeyMethodInfo();

I'd be interested in hearing responses to this as well, I'm using a
bookstore in my test, but the error is the same (RH7.2, Torque3-dev,
MySQL).  I am having the same problem as well.  When I call c.save(), I
get the following stack trace:

java.lang.NullPointerException
        at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:762)
        at com.kazmier.om.BaseAuthorPeer.doInsert(BaseAuthorPeer.java:169)
        at com.kazmier.om.BaseAuthorPeer.doInsert(BaseAuthorPeer.java:435)
        at com.kazmier.om.BaseAuthor.save(BaseAuthor.java:337)
        at com.kazmier.om.BaseAuthor.save(BaseAuthor.java:302)
        at com.kazmier.om.BaseAuthor.save(BaseAuthor.java:285)
        at com.kazmier.MyTest.main(MyTest.java:19)

However, if I replace c.save(), with AutherPeer.doInsert(c), everything
works ok.  So I would speculate that if you replace your c.save() with
CivilizationPeer.doInsert(c), that it would work.  Torque is completely
new to me, but I was able to build the source, get it to create my
database, but I get stuck with my simple test app.  Any suggestions?
I've searched the archives for help, but I haven't found anything yet.

In addition, I am also a little confused with the concept of the
"default" database in the Torque properties file.  I explicitly set the
database name in my schema file, then added appropriate lines to my
torque properties file, but the id-table-schema.xml doesn't explicitly
define a database name in the <database> tag, so in my sql/create-db.sql
file, I had a lines like this:

drop database if exists default;
create database default;
drop database if exists bookstore;
create database bookstore;

I'm using MySQL and it seems that MySQL gags on the keyword "default".
So I just added a name to the id-table-schema <database> tag to be
"bookstore" and everything was ok.  Is this what I should do?  Or is the
behavior I saw the result of an error on my part?

> Also, I personally was a bit confused when I decided to use Torque on it's
> own about torque-2.1 and the torque in CVS.  If you look at the docs on
> the webpage, it doesn't say anything about either, it just says "torque
> has been decoupled from turine and the decoupled version will be used from
> 2.2 on".  If you read the mailing list archives though, you find a million
> people saying, "don't use 2.1, get the version from cvs and build it."
> Maybe a note about this would be in order?  If I personally feel the
> documentation has a shortcoming, is the generally encouraged practice
> "make whatever change you want to the xdoc and mail it to turbine-dev and
> see what they think"?

I got stuck Sunday evening, so as a peace offering :), before I posted
my questions to the mailing list, I decided to start the creation of a
standalone Torque tutorial that hopefully might someday be included on
the Torque pages for new users like me.  I was going to complete as much
as possible before posting to prove that I am not just a leech, but when
I saw this post, I figured I'd chime in here.  To prove that I'm not
blowing smoke, here is the start of the tutorial and the general outline
of it.  Once I get my first Torque app running, I should be able to
complete it.  

http://www.kazmier.com/~kaz/torque [click on tutorial link in Guides]

Any comments would be welcome, there isn't much there yet, but I tried
to outline what I thought would be in the tutorial, if I am missing
something, then let me know.

Thanks!
Pete

-- 
Peter Kazmier                                 http://www.kazmier.com
PGP Fingerprint   4FE7 8DA3 D0B5 9CAA 69DC  7243 1855 BC2E 4B43 5654

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to