db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zamek <za...@vili.pmmf.hu>
Subject Re: Bug in doSelectJoinPortalUser?
Date Wed, 19 Mar 2003 17:08:31 GMT
Eric Emminger wrote:
> 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
I did step by step from Extended-user howto. Does your doSelectJoinXXX 
working good?
It seems to be offset in poulateObject specially for that case, when 
object data isn't in 1th. index. If I interpreted well doselectjoins, it 
  append an extra columns to object for user field and
make a portaluser object into this. The Sql field orders is 
baseobjectfields and then userfields. It is force to populating user 
object form an offset.

And when I change to
Value value = row.getValue(j + offset)
it is working good.

Zoltan Zidarics programmer
PTE University Pecs, Hungary
icq: 43288694

View raw message