Henrik,

Firstly, your queries would be better addressed to
[EMAIL PROTECTED] (torque has had it's own mailing lists for
quite some time, but these recently moved from jakarta to db.apache.org).
I'll try and provide some assistance anyway.

MySQL by default does not support transactions (and even when the
transactional tables are used I do not believe that anyone has attempted to
use these with torque yet) so I am not at all surprised that you see
different behaviour with MySQL and PostgreSQL.

For transactions the idiom is something like this:

Connection conn = null;
try
{
    conn = Transaction.begin(Torque.getDefaultDB());
    someObject.save(conn);
    someOtherObject.save(conn);
    Transaction.commit(conn);
}
catch (TorqueException ex)
{
    try
    {
        Transaction.rollback(conn);
    }
    catch (TorqueException ex2)
    { 
        Log.error(ex2);
    }
    Log.error(ex);
}

In your case I would suggest that torque is automatically saving the
pollquestion as part of saving the poll - this may explain the message you
are receiving.

Switch to the correct idiom and see how things go.

HTH,

Scott
-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au
.Mac Chat/AIM: seade at mac dot com


On 18/02/2003 9:39 PM, "Henrik W. Hansen" <[EMAIL PROTECTED]> wrote:

> Hi again
> I just tried this on MySQL, here it work fine! So, where should I look
> for an solution. My guess is that the problem might be foreign key
> releated or it could be some PostgreSQL configuration problem.
> Anybody?
> 
> /Henrik
> Henrik W. Hansen wrote:
> 
>> Hi all,
>> I am new to torque, and I am having some problems with updating
>> values. I am running agains PostgreSQL. When trying to update I get
>> the following error message:
>> WARNING:  COMMIT: no transaction in progress
>> 
>> I have to following java:
>> Poll p;
>> Pollquestion pollquestion;:
>> List pollquestionList ;
>> pw = (PollWrapper) data.getUser().getTemp("editableobject");
>> //PollWrapper stores objects
>> p = pw.getPoll(); //Gets the poll object that will be changed
>> pollquestion = (Pollquestion) pw.getPollquestions().get(0);
>> p.setPollname(data.getParameters().get("pollname")); //sets the value
>> from the form/request
>> p.setActive(data.getParameters().getBoolean("active")); //   -||-
>> pollquestion.setQuestion("Something meaningfull");
>> try {
>>    p.save(); //saves, but gives the warning.
>>    pollquestion.save(); //Does not get saved, but gives the warning.
>> } catch (Exception e) {
>>    logger.error("Error saving poll: " + e);
>>    e.printStackTrace();
>> }
>> 
>> Am I supposed to call some start transaction metod and a commit? I
>> looks like, according to the error/warning message, that postgres
>> receives a commit without being aware of a transaction start! P are
>> persisted, but I have some side effects on this issuse. The
>> PollWrapper object contains the objects related to Poll, the
>> pollquestions. When i work on a PollQuestion I can call save on that a
>> PollQuestion, but is is not stored! The postgres console gives the
>> mentioned warning.
>> I am lost. Where do I look?
>> 
>> My table definitions are the following:
>>  <table name="Poll" description="Poll">
>>    <column
>>      name="PollID"
>>      required="true"
>>      primaryKey="true"
>>      autoIncrement="true"
>>      type="INTEGER" />
>>    <column
>>      name="PollName"
>>      required="true"
>>      type="VARCHAR"
>>      size="128"/>
>>    <column
>>      name="Active"
>>      default="false"
>>      required="true"
>>      type="BIT"/>
>>  </table>
>> 
>>  <table name="PollQuestion" description="Contains related questions to
>> a poll">
>>    <column
>>      name="QuestionID"
>>      required="true"
>>      primaryKey="true"
>>      autoIncrement="true"
>>      type="INTEGER"/>
>>    <column
>>      name="PollID"
>>      required="true"
>>      type="INTEGER"/>
>>    <column
>>      name="Question"
>>      required="true"
>>      type="VARCHAR"
>>      size="254"/>
>>    <foreign-key foreignTable="Poll">
>>      <reference
>>        local="PollID"
>>        foreign="PollID"/>
>>    </foreign-key>
>>  </table>
>> 
>> I hope someone can help, because this is driving me nuts....
>> /Henrik
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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

Reply via email to