You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Stefan Krause <st...@minet.uni-jena.de> on 2002/01/30 15:29:49 UTC

torque: rollback on mysql

Hi,

I have a problem with storing data in the mysql database. When I 
call the save() method I get an error in the torque.log file which says
my database do not allow this operation. But rollback is allowed by
mysql.
Can someone give me an advice?

this is my simple test-class:

package org.openscience.nmrshiftdb;

import org.apache.torque.Torque;
import org.apache.torque.util.Criteria;
import org.openscience.nmrshiftdb.*;
import java.util.*;

public class DBTest
{	
	public static void main(String[] args)
	{
		try
		{
			Torque.init("/home/stefan/dev/nmrshiftdb/schema/Torque.properties");
			Contributor con = new Contributor();
			con.setId("1");
			con.setFirstName("firstname");
			con.setLastName("lastname");
			con.save();
		}
		catch (Exception exc)
		{
		}
	}
}


Here is the error message i got in the torque.log file:

INFO - Logging has been configured by Torque.
DEBUG - Using org.apache.torque.adapter.DBMM
INFO - IDBroker thread was started.
WARN - IDBroker is being used with db 'nmrshiftdb', which does not
support transactions.
IDBroker attempts to use transactions to limit the possibility of
duplicate key generation. 
Without transactions, duplicate key generation is possible if multiple
JVMs are used or 
other means are used to write to the database.
INFO - Forced id retrieval - no available vector
DEBUG - BasePeer.doUpdate: whereClause=TABLE_NAME='CONTRIBUTOR'
ERROR - An attempt was made to rollback a transaction but the database
did not allow the operation to be rolled back.

Thanks.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Torque: Joining tables What am I doing wrong ?

Posted by Emmanuel Bardet <em...@bardet.org>.
But of course. Silly me. Thanks and sorry.

> -----Original Message-----
> From: Wolfgang Klier [mailto:wolfi@nautilus.noreply.org]
> Sent: mercredi 30 janvier 2002 17:30
> To: Turbine Users List
> Subject: Re: Torque: Joining tables What am I doing wrong ?
> 
> 
> Hi
> On Wed, Jan 30, 2002 at 03:46:00PM -0000, Emmanuel Bardet wrote:
> > critUnit.addJoin ( TarMenuFoodPeer.FOOD_ID,
> > tarMenuFoodLanguageName.getFoodId().toString() );
> 
> This is no JOIN, but a constraint.
> 
> Wolfgang
> 
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Torque: Joining tables What am I doing wrong ?

Posted by Wolfgang Klier <wo...@nautilus.noreply.org>.
Hi
On Wed, Jan 30, 2002 at 03:46:00PM -0000, Emmanuel Bardet wrote:
> critUnit.addJoin ( TarMenuFoodPeer.FOOD_ID,
> tarMenuFoodLanguageName.getFoodId().toString() );

This is no JOIN, but a constraint.

Wolfgang

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: torque: rollback on mysql

Posted by Pete Kazmier <pe...@kazmier.com>.
Stefan,

It would be helpful if you included your schema, build.propertiers, and
run-time properties as well.  Rather than post these to the list, feel
free to send these to me directly and I'll take a look at them for you,
and post the results back to the list.  

In addition, you may want to read the tutorial that I am putting
together.  I'm sure if you followed that you'd find your problem  The
URL to the work-in-progress is:

http://www.kazmier.com/~kaz/torque/tutorial.html

Thanks,
Pete

On Wed, Jan 30, 2002 at 03:29:49PM +0100, Stefan Krause wrote:
> Hi,
> 
> I have a problem with storing data in the mysql database. When I 
> call the save() method I get an error in the torque.log file which says
> my database do not allow this operation. But rollback is allowed by
> mysql.
> Can someone give me an advice?
> 
> this is my simple test-class:
> 
> package org.openscience.nmrshiftdb;
> 
> import org.apache.torque.Torque;
> import org.apache.torque.util.Criteria;
> import org.openscience.nmrshiftdb.*;
> import java.util.*;
> 
> public class DBTest
> {	
> 	public static void main(String[] args)
> 	{
> 		try
> 		{
> 			Torque.init("/home/stefan/dev/nmrshiftdb/schema/Torque.properties");
> 			Contributor con = new Contributor();
> 			con.setId("1");
> 			con.setFirstName("firstname");
> 			con.setLastName("lastname");
> 			con.save();
> 		}
> 		catch (Exception exc)
> 		{
> 		}
> 	}
> }
> 
> 
> Here is the error message i got in the torque.log file:
> 
> INFO - Logging has been configured by Torque.
> DEBUG - Using org.apache.torque.adapter.DBMM
> INFO - IDBroker thread was started.
> WARN - IDBroker is being used with db 'nmrshiftdb', which does not
> support transactions.
> IDBroker attempts to use transactions to limit the possibility of
> duplicate key generation. 
> Without transactions, duplicate key generation is possible if multiple
> JVMs are used or 
> other means are used to write to the database.
> INFO - Forced id retrieval - no available vector
> DEBUG - BasePeer.doUpdate: whereClause=TABLE_NAME='CONTRIBUTOR'
> ERROR - An attempt was made to rollback a transaction but the database
> did not allow the operation to be rolled back.
> 
> Thanks.
> 
> Stefan
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 

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

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: torque: rollback on mysql

Posted by Erich Meier <em...@methodpark.de>.
On Wed, Jan 30, 2002 at 03:29:49PM +0100, Stefan Krause wrote:
> Hi,
> 
> I have a problem with storing data in the mysql database. When I 
> call the save() method I get an error in the torque.log file which says
> my database do not allow this operation. But rollback is allowed by
> mysql.
> Can someone give me an advice?

I assume, that you use the mm.mysql JDBC driver. It has some transaction
fixes in release 2.0.8 so you should check that your version is up-to-date.

Version 2.0.6 returned false on
	getConnection().getMetaData().supportsTransactions()
which was corrected.

Hope this helps,
Erich

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Torque: Joining tables What am I doing wrong ?

Posted by Emmanuel Bardet <em...@bardet.org>.
Hello guys,

Pretty straight forward but I can't make it work!

This code:
Criteria critUnit = new Criteria();
critUnit.addJoin( TarMenuNamePeer.NAME_ID,
TarMenuUnitLanguageNamePeer.NAME_ID );
critUnit.addJoin( TarMenuUnitLanguageNamePeer.UNIT_ID,
TarMenuFoodPeer.UNIT_ID );
critUnit.addJoin ( TarMenuFoodPeer.FOOD_ID,
tarMenuFoodLanguageName.getFoodId().toString() );
critUnit.add (TarMenuUnitLanguageNamePeer.LANGUAGE_ID, language_id);

Vector vector = TarMenuNamePeer.doSelect( critUnit );

throws an exception:
Exception:  java.lang.StringIndexOutOfBoundsException: String index out of
range: -1
Stack Trace follows:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1525)
at org.apache.turbine.om.peer.BasePeer.createQueryString(BasePeer.java:1033)
at org.apache.turbine.om.peer.BasePeer.doSelect(BasePeer.java:1131)
at
com.mctar.menu.om.BaseTarMenuNamePeer.doSelectVillageRecords(BaseTarMenuName
Peer.java:197)
at
com.mctar.menu.om.BaseTarMenuNamePeer.doSelect(BaseTarMenuNamePeer.java:167)


I don't see what I'm doing wrong here. Can anybody help ?

Thanks.

Emmanuel.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>