db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Emminger <e...@ericemminger.com>
Subject Re: Bug in doSelectJoinPortalUser?
Date Wed, 19 Mar 2003 15:48:27 GMT
Hi Zamek

> I was try to use doSelectJoinPortalUser and it was'nt working good.
> I made 2 tables :
> 
> <table name="STUDENT" idMethod="native" javaName="Student" >
>  <column name="S_ID" primaryKey="true" required="true" 
> type="INTEGER"              javaType="object"/>
>   <column name="S_USERID" required="true" type="INTEGER" />
>   <column name="S_SPECIALISATION" required="false" type="INTEGER"></column>
>   <column name="S_EHA" required="true" type="VARCHAR" size="15"></column>
>   <id-method-parameter value="student_seq"/>   
>   <foreign-key foreignTable="TURBINE_USER" onDelete="cascade">
>        <reference local="S_USERID" foreign="USER_ID"/>
>   </foreign-key>
> ...   
> </table>
> 
> <table name="TURBINE_USER" alias="TurbineUser" javaName="PortalUser"
>         baseClass="com.zamek.vili.om.TurbineUserAdapter"
>         basePeer="com.zamek.vili.om.TurbineUserPeerAdapter">
>  <column name="USER_ID" primaryKey="true" required="true" 
> type="INTEGER"             javaType="object" />
> </table>
> 
> It is a simple foreign key relation. Torque generate a 
> doSelectJoinPortalUser method in StudentPeer class, but when I try to 
> call Student.getPortalUser().getFirstName(), it give wrong value.
> I was redefine PortalUserPeer.populateObject(Record row, int offset, 
> User obj)
> and I was wondering that offset parameter doesn't used in this method.
> When I change    Value value = row.getValue(j + 1); to
>   Value value = row.getValue(j + offset);
> its working good!
> 
> Question is it a bug, or I don't understanding something?

I don't use an alias to TurbineUser, so I'm not real sure about this. 
But, I'm guessing it's a bug. I don't think you should have to change 
*anything* in the Peer to get the correct value from the FIRST_NAME 
property.

Eric



Mime
View raw message