You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Dale Thoms <dt...@pobox.com> on 2004/03/01 19:18:45 UTC
Re: deep collection possible?
Hi Tomasz,
There should be a protected method in your BaseServerPeer.java called
doSelectJoinFile(crit) that will fill in the File objs in the Servers.
You'll need to make a public wrapper method for it in ServerPeer.java,
so you can then call ServerPeer.doSelectJoinFile(crit).
Dale
On Sun, 29 Feb 2004 23:26:04 +0100, "Tomasz Dreßler"
<td...@terragate.net> said:
> Hi!
> I have two tables 'server' and 'file'.
> Without torque I used the query:
> SELECT server.serverAdress, server.serverName, file.filePath,
> file.fileName
> FROM server, file
> WHERE server.serverAdress=file.serverAdress
> AND file.fileName like '%search%'
>
> I wish that ServerPeer.doSelect(crit) returns a collection of servers.
> Each server should include the file objects belong to that server.
>
> I just get the server without the file objects.
>
> Thanks,
> Tomasz Dreßler
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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
R: deep collection possible?
Posted by Luca Zappa <lu...@lucazappa.com>.
Foreign key is declared in 'file' table so in the class BaseFilePeer you
have the method:
protected static List doSelectJoinServer(Criteria c)
As Dale said you need to add a wrapper method in FilePeer to call that
protected method.
public static java.util.List
doSelectJoinServer(org.apache.torque.util.Criteria c) throws
org.apache.torque.TorqueException {
return BaseFilePeer.doSelectJoinServer(c);
}
Bye,
Luca
-----Messaggio originale-----
Da: Tomasz Dreßler [mailto:tdress@terragate.net]
Inviato: lunedì 1 marzo 2004 21.36
A: Apache Torque Users List
Oggetto: Re: deep collection possible?
Hi Thoms! Thanks for reply.
My BaseServerPeer.java does not contain such protected method.
Out of necessity I call the getFiles(crit) method from each server object.
Maybe the Problem is in schema.xml ?
Greetings
Tomasz
[--- schema.xml ---]
<table name="server" description="Server Tabelle" idMethod="none">
<column name="serverAdress" primaryKey="true"
required="true" type="VARCHAR" size="255"
description="Server Adresse" />
<column name="serverName"
required="true" type="VARCHAR"
size="128" description="Server Name" />
</table>
<table name="file" description="File Tabelle" idMethod="native">
<column name="fileId" required="true" primaryKey="true"
type="INTEGER" autoIncrement="true"
description="File ID" />
<column name="serverAdress" required="true"
type="VARCHAR" size="255"
description="FK Server Adresse" />
<column name="filePath" required="true"
type="LONGVARCHAR"
description="File Pfad" />
<column name="fileName" required="true"
type="VARCHAR" size="255"
description="File Name" />
<foreign-key foreignTable="server" onUpdate="cascade">
<reference local="serverAdress" foreign="serverAdress"/>
</foreign-key>
</table>
Dale Thoms wrote:
>Hi Tomasz,
>
>There should be a protected method in your BaseServerPeer.java called
>doSelectJoinFile(crit) that will fill in the File objs in the Servers.
>You'll need to make a public wrapper method for it in ServerPeer.java,
>so you can then call ServerPeer.doSelectJoinFile(crit).
>
> Dale
>
>
>
>On Sun, 29 Feb 2004 23:26:04 +0100, "Tomasz Dreßler"
><td...@terragate.net> said:
>
>
>>Hi!
>>I have two tables 'server' and 'file'.
>>Without torque I used the query:
>>SELECT server.serverAdress, server.serverName, file.filePath,
>>file.fileName FROM server, file WHERE
>>server.serverAdress=file.serverAdress
>>AND file.fileName like '%search%'
>>
>>I wish that ServerPeer.doSelect(crit) returns a collection of servers.
>>Each server should include the file objects belong to that server.
>>
>>I just get the server without the file objects.
>>
>>Thanks,
>>Tomasz Dreßler
>>
>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>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
>
>
>
>
---------------------------------------------------------------------
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
Re: deep collection possible?
Posted by Tomasz Dreßler <td...@terragate.net>.
Hi Thoms! Thanks for reply.
My BaseServerPeer.java does not contain such protected method.
Out of necessity I call the getFiles(crit) method from each server object.
Maybe the Problem is in schema.xml ?
Greetings
Tomasz
[--- schema.xml ---]
<table name="server" description="Server Tabelle" idMethod="none">
<column name="serverAdress" primaryKey="true"
required="true" type="VARCHAR" size="255"
description="Server Adresse" />
<column name="serverName"
required="true" type="VARCHAR"
size="128" description="Server Name" />
</table>
<table name="file" description="File Tabelle" idMethod="native">
<column name="fileId" required="true" primaryKey="true"
type="INTEGER" autoIncrement="true"
description="File ID" />
<column name="serverAdress" required="true"
type="VARCHAR" size="255"
description="FK Server Adresse" />
<column name="filePath" required="true"
type="LONGVARCHAR"
description="File Pfad" />
<column name="fileName" required="true"
type="VARCHAR" size="255"
description="File Name" />
<foreign-key foreignTable="server" onUpdate="cascade">
<reference local="serverAdress" foreign="serverAdress"/>
</foreign-key>
</table>
Dale Thoms wrote:
>Hi Tomasz,
>
>There should be a protected method in your BaseServerPeer.java called
>doSelectJoinFile(crit) that will fill in the File objs in the Servers.
>You'll need to make a public wrapper method for it in ServerPeer.java,
>so you can then call ServerPeer.doSelectJoinFile(crit).
>
> Dale
>
>
>
>On Sun, 29 Feb 2004 23:26:04 +0100, "Tomasz Dreßler"
><td...@terragate.net> said:
>
>
>>Hi!
>>I have two tables 'server' and 'file'.
>>Without torque I used the query:
>>SELECT server.serverAdress, server.serverName, file.filePath,
>>file.fileName
>>FROM server, file
>>WHERE server.serverAdress=file.serverAdress
>>AND file.fileName like '%search%'
>>
>>I wish that ServerPeer.doSelect(crit) returns a collection of servers.
>>Each server should include the file objects belong to that server.
>>
>>I just get the server without the file objects.
>>
>>Thanks,
>>Tomasz Dreßler
>>
>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>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
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org