db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shin Ohkubo" <sh.ok...@po1.iftc.co.jp>
Subject RE: selecting from multiple tables + setting results as a session
Date Mon, 26 May 2003 01:45:04 GMT
Dear Dieter:

Thanx for your help!
Relying on your advise, I figured out how to do my SQL.
	crit.addJoin(EmpPeer.EMPNO, PostPeer.POSTID);
	crit.addSelectColumn(EmpPeer.EMPNO);
	crit.addSelectColumn(EmpPeer.EMPNAME);
	crit.addSelectColumn(PostPeer.POSTID);
	crit.addSelectColumn(PostPeer.POSTNAME);
	List empList = org.apache.torque.util.BasePeer.doSelect(crit);
In your reply, "add" was implied but it would not compile, so I used
addSelectColumn instead.
Is this how you done it?

Additionaly, I want to set these results into a session and view them
via JSP.
When I use the normal way (use the doSelect of EmpPeer), the results
will be something like:
	 empno=1
	 empname=shin
	 postid=1
	 , empno=2
	 empname=nancy
	 postid=2

So I can get each of the session data quite easily like this:
	<logic:iterate id="oneEmp" name="imaken.empList"
scope="session">
	    <tr>
		<td><bean:write name="oneEmp" property="empno" /></td>
		<td><bean:write name="oneEmp" property="empname" /></td>
		<td><bean:write name="oneEmp" property="postid" /></td>
	    </tr>
	</logic:iterate>
But this time when I am using the doSelect of BasePeer, the results will
be something like:
	 {{1, 'shin', 1, 'sales'}, {2, 'nancy', 2, 'researcher'}}
This time I can't get the session data via the properties such as empno,
empname, postid or postname.

Anyone know a way to solve this problem?
Many thanx.
Shin O.


Mime
View raw message