Is this.getPeer() == BasePeer? I'm pretty sure not, and that's the problem.

You need to make sure you construct your criteria object with the peer you
execute the query with. 

this.getPeer().doSelect(criteria)

Torque translates "Select from"... to "select <each individual column name>
from" in the select process within the peer you are using... however
BasePeer can not perform that substitution, because it doesn't know about
the specifics of the table you're querying... only the OM peer that goes
with that table can do the substitution (see the addSelectColumns method in
your Peer object, and note its absence in BasePeer).

This also explains why if you give explicit column names it works, because
BasePeer doesn't need to any substitutions, and can just perform the query
outright. 


-d


-----Original Message-----
From: Dieter Engelhardt [mailto:[EMAIL PROTECTED]] 
Sent: Monday, December 09, 2002 8:11 AM
To: Turbine Users List
Subject: AW: select * from ...

I still stick in the same question.

What i've done is this:

        public List getOrt(int iOrt_ID) throws Exception
        {
                Criteria criteria = new Criteria();
                criteria.add(this.getPeer().ORT_ID, iOrt_ID);
                return = BasePeer.doSelect(criteria);
        }

What i get is:
org.apache.torque.TorqueException: Syntax error or access violation: You
have an error in your SQL syntax near 'FROM TB_ORT WHERE TB_ORT.ORT_ID=1070'
at line 1

When i debug i find the SQL-Statment "select form ta_ort ....."

Obviously the * is missing.

If i add each Column with criteria.addSelectColumn() it works fine.

Is there a Methode to select all Columns? I bet that this is posible.

Thanx for your help.

-----Urspr�ngliche Nachricht-----
Von: Gaasch, Derek [mailto:[EMAIL PROTECTED]]
Gesendet: Samstag, 7. Dezember 2002 01:28
An: 'Turbine Users List'
Betreff: RE: select * from ...


2.2 rc1

are you sure your OM files & tables are as you expect them to be? Does the
problem only happen with a join (i.e. can you do a simple select with an
empty criteria object? Or with just a criteria added --like a primary key
id?)

-----Original Message-----
From: Dieter Engelhardt [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 5:22 PM
To: Turbine Users List
Subject: AW: select * from ...

Thats not the problem because if i put al my columes into the criteria, ir
works.

Like if i ad a statement it works fine

Criteria criteria = new Criteria();
criteria.addSelectColumn(this.getPeer().SomeColumn);
List v = this.getPeer().doSelect(criteria);

What version of Turbin do you user?


-----Urspr�ngliche Nachricht-----
Von: Gaasch, Derek [mailto:[EMAIL PROTECTED]]
Gesendet: Samstag, 7. Dezember 2002 01:15
An: 'Turbine Users List'
Betreff: RE: select * from ...


Put the id in quotes?

-----Original Message-----
From: Dieter Engelhardt [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 5:14 PM
To: Turbine Users List
Subject: AW: select * from ...

The problem is described below.
I get an exception.

Im using TDK 2.2 rc1.

-----Urspr�ngliche Nachricht-----
Von: Gaasch, Derek [mailto:[EMAIL PROTECTED]]
Gesendet: Samstag, 7. Dezember 2002 01:07
An: 'Turbine Users List'
Betreff: RE: select * from ...


And the problem is?

Criteria c = new Criteria();
c.add(SomePeer.ID,"1155");
SomePeer.doSelect (c);

http://jakarta.apache.org/turbine/torque/criteria-howto.html


-D


-----Original Message-----
From: Dieter Engelhardt [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 4:40 PM
To: Turbine Users List
Subject: AW: select * from ...

This might work, but i need to add some extra criteria
like select * from sometab where id = id_value

-----Urspr�ngliche Nachricht-----
Von: Gaasch, Derek [mailto:[EMAIL PROTECTED]]
Gesendet: Samstag, 7. Dezember 2002 00:36
An: 'Turbine Users List'
Betreff: RE: select * from ...


Just use an empty Criteria object.


SomePeer.doSelect (new Criteria())


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 3:51 PM
To: Jakarta-Turbine
Subject: select * from ...

How do i accomplish a simple select * from sometable without specifing every
selectColumn.

Example:

Criteria criteria = new Criteria();
criteria.addJoin(TbOrtPeer.OLP_ID, TbOrtLookupPeer.OLP_ID);
criteria.add(this.getPeer().ORT_ID, iOrt_ID);
List v = this.getPeer().doSelect(criteria);

i'll get an exception "Syxntaxerror in SQL-Statement"

It looks like the statement misses the * as a wildcard for all columns.

If i try add criteria.addSelectColumn("*");

I get an exception "Malformed column name in Criteria select: '*' is not of
the form 'table.column'"

What's wrong?
How can i do it right?

Thanx for your help
Dieter




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

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


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

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


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

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


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

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


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

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

Reply via email to