Shaun Campbell wrote:
>
> Ok got Turbine and Torque working fine now and am very impressed but I think
> we may have come up against a bit of a problem.
>
> The problem is that, as in the real world, the data we wish to display on
> the screen comes from more than one table. i.e we want to translate a
> status code to a description from a lookup table. Normally you would just
> join the two tables together via the status id and display what you want to
> the screen.
>
By selecting objectModel=complex in torque.props, you will generate
om/peer objects that contain join methods based on the foreign key
relationships in your schema. There are sure to be bugs, but the api is
there and I hope any bugs are easy to work out. There are possibilities
that are not implemented, but you can use the examples from the
generated code, to guide coding for a specific need. Or if you take the
time to generalize your specific needs, the code generated by torque can
be made more complete.
> We have thought of a couple of ways around this are but not sure if there is
> a better way to do it.
>
> Firstly, in the java class we could select the rows we are interested in,
> cycle around them and then do a separate select on the lookup table, passing
> through all the data through to the template.
>
> The other option is to do separate selects in the java class on both tables
> and then pass the vectors of data through to the template. Then in the
> template we have to do a foreach loop around the vector of lookup data
> inside our foreach loop of our main data.
>
Again, torque with objectModel=complex will give you methods that can
work by joining tables and grabbing all the data at once, or selecting
rows from one table and performing individual selects, based on foreign
keys.
> The second option seems to be the best but I wondered whether there was a
> way to do this all in one select statement with Torque.
>
> Thanks
>
> Shaun
>
> ------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?: [EMAIL PROTECTED]
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]