Stewart,
I am not quite sure what you are doing wrong. I downloaded and
installed Postgres just for you and tried the example in my tutorial.
It worked fine without any glitches.
Then, I looked at all of the files you sent me: your application code,
build.properties, schemas, and run-time properties. They were full of
errors. After I made many modifications, too many to remember, I was
able to get your application to run fine.
At this point, all I can offer is that you read the tutorial and pay
very close attention to your configuration files. I'm also attaching
your application and all of the modified files I used to get your
application working.
Good luck!
Pete
On Fri, Jan 25, 2002 at 01:02:37PM +0000, stewart titan wrote:
> Tried that, doesn't work, below is the *-schema.xml
>
> I've tried changing defaultIdMethod to IdMethod.
> (I'm using Torque 3 standalone)
log4j.rootCategory = DEBUG, default
log4j.appender.default = org.apache.log4j.FileAppender
log4j.appender.default.file = ./torque.log
log4j.appender.default.layout = org.apache.log4j.SimpleLayout
torque.database.default=apps
torque.database.apps.driver=org.postgresql.Driver
torque.database.apps.url=jdbc:postgresql://localhost/apps
torque.database.apps.username=kaz
torque.database.apps.password=kaz
# -------------------------------------------------------------------
#
# T O R Q U E C O N F I G U R A T I O N F I L E
#
# -------------------------------------------------------------------
# -------------------------------------------------------------------
#
# T U R B I N E P R O J E C T
#
# -------------------------------------------------------------------
# This is the name of your Turbine project. Your generated sources
# will be named using the project name selected below. If your
# project=killerapp then you will have a generated:
#
# killerapp-schema.sql
#
# IMPORTANT!
# This means that your project schema MUST be named
# killerapp-schema.xml and it MUST be placed in the
# schema directory for Torque to work property.
#
# The object model sources generated are independent of
# the project name selected.
# -------------------------------------------------------------------
project = apps
# -------------------------------------------------------------------
#
# T A R G E T D A T A B A S E
#
# -------------------------------------------------------------------
# This is the target database, only considered when generating
# the SQL for your Turbine project. Your possible choices are
#
# db2
# db2400
# hypersonic
# mysql
# oracle
# postgresql
# mssql
#
# Default: none
# -------------------------------------------------------------------
database = postgresql
# -------------------------------------------------------------------
#
# O B J E C T M O D E L I N F O R M A T I O N
#
# -------------------------------------------------------------------
# These settings will allow you to customize the way your
# Peer-based object model is created.
# -------------------------------------------------------------------
# addSaveMethod=true adds tracking code to determine how to save objects
#
# addGetByNameMethod=true adds methods to get fields by name/position
#
# complexObjectModel=true generates an om with collection support
#
# addTimeStamp=true puts time stamps in generated files
#
# addIntakeRetrievable=implement Intake's Retrievable interface
# -------------------------------------------------------------------
targetPackage=org.stewart.TorqueTest.Entity
basePrefix=Base
addSaveMethod=true
addGetByNameMethod=true
complexObjectModel=true
addTimeStamp=true
addIntakeRetrievable=false
# -------------------------------------------------------------------
#
# D A T A B A S E S E T T I N G S
#
# -------------------------------------------------------------------
# JDBC connection settings. This is used by the JDBCToXML task that
# will create an XML database schema from JDBC metadata. These
# settings are also used by the SQL Ant task to initialize your
# Turbine system with the generated SQL.
# -------------------------------------------------------------------
createDatabaseUrl = jdbc:postgresql://localhost:5432/template1
databaseUrl = jdbc:postgresql://localhost:5432/apps
databaseDriver = org.postgresql.Driver
databaseUser = kaz
databasePassword = kaz
databaseHost = localhost
# Tells JDBC task that javaName attribute for the tables and columns
# should be made same as SQL name.
sameJavaName=false
# -------------------------------------------------------------------
#
# D O C U M E N T A T I O S E T T I N G S
#
# -------------------------------------------------------------------
# These settings will allow you to customize the way your schema
# documentation is created.
# Valid formats are: html, anakia (for use with jakarta-site2)
# -------------------------------------------------------------------
documentationFormat=html
# -------------------------------------------------------------------
# You should NOT have to edit anything below here.
# -------------------------------------------------------------------
# -------------------------------------------------------------------
#
# T E M P L A T E P A T H
#
# -------------------------------------------------------------------
templatePath = templates
# -------------------------------------------------------------------
#
# C O N T R O L T E M P L A T E S
#
# -------------------------------------------------------------------
SQLControlTemplate = sql/base/Control.vm
OMControlTemplate = om/Control.vm
idTableControlTemplate = sql/id-table/Control.vm
DataDTDControlTemplate = data/Control.vm
DataDumpControlTemplate = data/dump/Control.vm
DataSQLControlTemplate = sql/load/Control.vm
DocControlTemplate = doc/Control.vm
# -------------------------------------------------------------------
#
# O U T P U T D I R E C T O R Y
#
# -------------------------------------------------------------------
outputDirectory=src
# -------------------------------------------------------------------
#
# S C H E M A D I R E C T O R Y
#
# -------------------------------------------------------------------
schemaDirectory=schema
<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
<!DOCTYPE database SYSTEM "http://jakarta.apache.org/turbine/dtd/database.dtd">
<!-- ==================================================================== -->
<!-- -->
<!-- E X A M P L E T O R Q U E S C H E M A -->
<!-- -->
<!-- ==================================================================== -->
<!--
Note: You must now specify a database name.
-->
<database name="apps" defaultIdMethod="idbroker">
<table name="Application">
<column name="ApplicationID" required="true" autoIncrement="true" primaryKey="true" type="INTEGER"/>
<column name="ApplicationName" required="true" size="50" type="VARCHAR"/>
<column name="Platform" required="true" size="20" type="VARCHAR"/>
<column name="Cost" required="false" type="FLOAT"/>
</table>
</database>
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!-- <!DOCTYPE database SYSTEM
"http://jakarta.apache.org/turbine/dtd/database.dtd"> -->
<!-- ==================================================================== -->
<!-- -->
<!-- I D B R O K E R S C H E M A -->
<!-- -->
<!-- ==================================================================== -->
<!-- This is the XML schema use by Torque to generate the SQL for -->
<!-- ID_TABLE table used by the id broker mechanism in Turbine. -->
<!-- ==================================================================== -->
<!-- @author: <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a> -->
<!-- @version $Id: id-table-schema.xml,v 1.3 2001/11/05 23:40:59 jvanzyl Exp $ -->
<!-- ==================================================================== -->
<database name="apps">
<table name="ID_TABLE" idMethod="idBroker">
<column name="ID_TABLE_ID" required="true" primaryKey="true" type="INTEGER"/>
<column name="TABLE_NAME" required="true" size="255" type="VARCHAR"/>
<column name="NEXT_ID" type="INTEGER"/>
<column name="QUANTITY" type="INTEGER"/>
<unique>
<unique-column name="TABLE_NAME"/>
</unique>
</table>
</database>
package org.stewart.TorqueTest.Entity;
import org.apache.torque.Torque;
public class Test {
public static void main(String[] args)
{
try
{
Torque.init("./Torque.properties");
Application app = new Application();
app.setApplicationname("Borland JBuilder");
app.setPlatform("Linux");
app.setCost(10000);
app.save();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>