db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sonu Vijay <son...@yahoo.com>
Subject Re: Printing SQL
Date Thu, 04 Dec 2003 22:36:34 GMT
Thanks for your reply, there is something I missed.
I'm printing out the criteria. And I'm trying to
insert a record. The criteria.toString() gives me a
SELECT query. So I assumed that maybe BasePeer first
check if the record with that key exists and if not
then inserts it.

And if my assumption is true then after a SELECT I
should get an Insert SQL which I never get.

Selects are working fine, if I do only SELECTS I get
right results.

So I don't know what going on. First select and then
insert, is this how it works ?
If yes then where is the Insert Criteria created. And
I'm using all classes generated by Torque, right
insert method in my Peer and BasePeer is being called
but the Criteria that prints is a SELECT criteria and
not an Insert.

Don't know how to debug it.

Vijay



--- Jeff Rasmussen <jrasmussen@lnxi.com> wrote:
> This should work. I've been using it.
> 
> Criteria crit = new Criteria();
> ....
> ....
> ....
> System.out.println(crit.toString());
> 
> Jeff Rasmussen
> 
> On Thu, 2003-12-04 at 15:13, Sonu Vijay wrote:
> > Hi,
> > Can we print the actual SQL that is made out of
> the
> > Criteria.
> > My selects work but inserts don't, I need to see
> the
> > SQL as the following stack trace indicated syntax
> > errors.
> > 
> > Thanks
> > 
> > Vijay
> > 
> > -----------------------
> > java.sql.SQLException: [SQL0104] Token ) was not
> > valid. Valid tokens: DAY PATH YEAR LABEL MONTH
> OPTION
> > RESULT CONNECTION TRANSACTION.
> > 	at
> >
>
com.ibm.as400.access.JDError.throwSQLException(JDError.java:388)
> > 	at
> >
>
com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1088)
> > 	at
> >
>
com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPreparedStatement.java:208)
> > 	at
> >
>
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1419)
> > 	at
> >
>
com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1371)
> > 	at
> >
>
org.apache.commons.dbcp.cpdsadapter.PooledConnectionImpl.prepareStatement(PooledConnectionImpl.java:271)
> > 	at
> >
>
org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.prepareStatement(ConnectionImpl.java:372)
> > 	at
> >
>
com.workingdogs.village.Record.saveWithInsert(Unknown
> > Source)
> > 	at com.workingdogs.village.Record.save(Unknown
> > Source)
> > 	at com.workingdogs.village.Record.save(Unknown
> > Source)
> > 	at
> >
>
org.apache.torque.util.BasePeer.insertOrUpdateRecord(BasePeer.java:891)
> > 	at
> >
>
org.apache.torque.util.BasePeer.doInsert(BasePeer.java:725)
> > 	at
> >
>
com.suz.torque.pitchers.BaseTeamPeer.doInsert(BaseTeamPeer.java:218)
> > 	at
> >
>
com.suz.torque.pitchers.BaseTeamPeer.doInsert(BaseTeamPeer.java:565)
> > 	at
>
com.suz.torque.pitchers.BaseTeam.save(BaseTeam.java:1081)
> > 
> > __________________________________
> > Do you Yahoo!?
> > Free Pop-Up Blocker - Get it now
> > http://companion.yahoo.com/
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail:
> torque-user-help@db.apache.org
> > 
> > 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail:
> torque-user-help@db.apache.org
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message