You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by stewart titan <st...@yahoo.co.uk> on 2002/01/30 22:15:27 UTC

Torque 3, transactions and Postgres

Hi

When I'm trying to run Torque with JBoss/Tomcat 3.2.x,
I'm getting the following message (from the
jboss/tomcat console):

[IDBroker] IDBroker is being used with db 'jsptest',
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.

Postgres 7.1.x  supports Transactions - so what its
problem?

Also, I'm getting an error:

Error in handling UserAccountsTag Connection object is
null!

I'm running the same code on a non-web based app and
it works fine..

the code is: (which looks fine)

         JspWriter out = pageContext.getOut();

         Torque.init("Torque.properties");
         Criteria criteria = new Criteria();
         criteria.add(UsersPeer.USERID,"0");
UsersPeer.doSelect(criteria)
            Users user =
(Users)UsersPeer.doSelect(criteria).firstElement();


Thanks for any help

Stewart

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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


Re: BasePeer inserts "0" in place of my value

Posted by John McNally <jm...@collab.net>.
You should set the property idMethod="none" on the <table>

john mcnally

Emmanuel Bardet wrote:
> 
> This is following my previous message further down.
> 
> For some reason, the function BasePeer.doInsert doesn't save one field with
> the given value and returns a funny primary key which causes an exception
> further later the code. I would be very grateful if the developpers could
> help me on this one.
> 
> Thanks.
> 
> Emmanuel.
> 
> > -----Original Message-----
> > From: Emmanuel Bardet [mailto:emmanuel@bardet.org]
> > Sent: mercredi 30 janvier 2002 22:58
> > To: Turbine Users List
> > Subject: Insert -> ClassCastException: BigDecimal
> >
> >
> > Hello folks,
> >
> > Bizarre. I get a BigDecimal class cast exception whereas I do not
> > deal with
> > BigDecimal on this table.
> >
> > My table is as following:
> >
> >   <table name="RECIPE_LANGUAGE_DESCRIPTION">
> >     <column name="RECIPE_ID" required="true" primaryKey="true"
> > type="INTEGER"/>
> >     <column name="LANGUAGE_ID" required="true" primaryKey="true"
> > type="INTEGER"/>
> >     <column name="DESCRIPTION" type="LONGVARCHAR"/>
> >
> >     <foreign-key foreignTable="RECIPE">
> >         <reference local="RECIPE_ID" foreign="RECIPE_ID"/>
> >     </foreign-key>
> >     <foreign-key foreignTable="LANGUAGE">
> >         <reference local="LANGUAGE_ID" foreign="LANGUAGE_ID"/>
> >     </foreign-key>
> >   </table>
> >
> > My code is:
> >
> > RecipeLanguageDescription t = new RecipeLanguageDescription();
> > t.setRecipeId( "140" );
> > t.setLanguageId( "120" );
> > t.setDescription( "TEST" );
> >
> > RecipeLanguageDescriptionPeer.doInsert( t );
> >
> > And I get:
> >
> > [Wed Jan 30 22:29:02 GMT 2002] -- ERROR --
> >       Exception:  java.lang.ClassCastException: java.math.BigDecimal
> >       Stack Trace follows:
> >       java.lang.ClassCastException: java.math.BigDecimal
> >       at
> > com.mctar.menu.om.BaseTarMenuRecipeLanguageDescription.setPrimaryK
> > ey(BaseRec
> > ipeLanguageDescription.java:398)
> >       at
> > com.mctar.menu.om.BaseTarMenuRecipeLanguageDescriptionPeer.doInser
> > t(BaseReci
> > peLanguageDescriptionPeer.java:308)
> >       at
> > com.mctar.modules.actions.admin.RecipeUpdateAction.insertEntity(Re
> > cipeUpdate
> > Action.java:182)
> >
> > With '0', '120', 'TEST' in my DB!!!
> >
> > I must admit I do not really understand what's going on here.
> > Could anybody
> > help please ?
> >
> > Thanks,
> >
> > Emmanuel.
> >
> >
> > --
> > 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>

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


BasePeer inserts "0" in place of my value

Posted by Emmanuel Bardet <em...@bardet.org>.
This is following my previous message further down.

For some reason, the function BasePeer.doInsert doesn't save one field with
the given value and returns a funny primary key which causes an exception
further later the code. I would be very grateful if the developpers could
help me on this one.

Thanks.

Emmanuel.

> -----Original Message-----
> From: Emmanuel Bardet [mailto:emmanuel@bardet.org]
> Sent: mercredi 30 janvier 2002 22:58
> To: Turbine Users List
> Subject: Insert -> ClassCastException: BigDecimal
>
>
> Hello folks,
>
> Bizarre. I get a BigDecimal class cast exception whereas I do not
> deal with
> BigDecimal on this table.
>
> My table is as following:
>
>   <table name="RECIPE_LANGUAGE_DESCRIPTION">
>     <column name="RECIPE_ID" required="true" primaryKey="true"
> type="INTEGER"/>
>     <column name="LANGUAGE_ID" required="true" primaryKey="true"
> type="INTEGER"/>
>     <column name="DESCRIPTION" type="LONGVARCHAR"/>
>
>     <foreign-key foreignTable="RECIPE">
>         <reference local="RECIPE_ID" foreign="RECIPE_ID"/>
>     </foreign-key>
>     <foreign-key foreignTable="LANGUAGE">
>         <reference local="LANGUAGE_ID" foreign="LANGUAGE_ID"/>
>     </foreign-key>
>   </table>
>
> My code is:
>
> RecipeLanguageDescription t = new RecipeLanguageDescription();
> t.setRecipeId( "140" );
> t.setLanguageId( "120" );
> t.setDescription( "TEST" );
>
> RecipeLanguageDescriptionPeer.doInsert( t );
>
> And I get:
>
> [Wed Jan 30 22:29:02 GMT 2002] -- ERROR --
> 	Exception:  java.lang.ClassCastException: java.math.BigDecimal
> 	Stack Trace follows:
> 	java.lang.ClassCastException: java.math.BigDecimal
> 	at
> com.mctar.menu.om.BaseTarMenuRecipeLanguageDescription.setPrimaryK
> ey(BaseRec
> ipeLanguageDescription.java:398)
> 	at
> com.mctar.menu.om.BaseTarMenuRecipeLanguageDescriptionPeer.doInser
> t(BaseReci
> peLanguageDescriptionPeer.java:308)
> 	at
> com.mctar.modules.actions.admin.RecipeUpdateAction.insertEntity(Re
> cipeUpdate
> Action.java:182)
>
> With '0', '120', 'TEST' in my DB!!!
>
> I must admit I do not really understand what's going on here.
> Could anybody
> help please ?
>
> Thanks,
>
> Emmanuel.
>
>
> --
> 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>


Insert -> ClassCastException: BigDecimal

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

Bizarre. I get a BigDecimal class cast exception whereas I do not deal with
BigDecimal on this table.

My table is as following:

  <table name="RECIPE_LANGUAGE_DESCRIPTION">
    <column name="RECIPE_ID" required="true" primaryKey="true"
type="INTEGER"/>
    <column name="LANGUAGE_ID" required="true" primaryKey="true"
type="INTEGER"/>
    <column name="DESCRIPTION" type="LONGVARCHAR"/>

    <foreign-key foreignTable="RECIPE">
        <reference local="RECIPE_ID" foreign="RECIPE_ID"/>
    </foreign-key>
    <foreign-key foreignTable="LANGUAGE">
        <reference local="LANGUAGE_ID" foreign="LANGUAGE_ID"/>
    </foreign-key>
  </table>

My code is:

RecipeLanguageDescription t = new RecipeLanguageDescription();
t.setRecipeId( "140" );
t.setLanguageId( "120" );
t.setDescription( "TEST" );

RecipeLanguageDescriptionPeer.doInsert( t );

And I get:

[Wed Jan 30 22:29:02 GMT 2002] -- ERROR --
	Exception:  java.lang.ClassCastException: java.math.BigDecimal
	Stack Trace follows:
	java.lang.ClassCastException: java.math.BigDecimal
	at
com.mctar.menu.om.BaseTarMenuRecipeLanguageDescription.setPrimaryKey(BaseRec
ipeLanguageDescription.java:398)
	at
com.mctar.menu.om.BaseTarMenuRecipeLanguageDescriptionPeer.doInsert(BaseReci
peLanguageDescriptionPeer.java:308)
	at
com.mctar.modules.actions.admin.RecipeUpdateAction.insertEntity(RecipeUpdate
Action.java:182)

With '0', '120', 'TEST' in my DB!!!

I must admit I do not really understand what's going on here. Could anybody
help please ?

Thanks,

Emmanuel.


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