Excellent question, I was also wondering about this... But you should rather post it to the torque-list: [EMAIL PROTECTED]
> -----Ursprüngliche Nachricht----- > Von: Zamek [mailto:[EMAIL PROTECTED]] > Gesendet: Samstag, 8. Februar 2003 11:04 > An: Turbine Users List > Betreff: How addjoin of criteria works? > > > Hi All, > I read Criteria howto, but I don't understand working of criteria. > Forexample: a forum apps has 2 table topic and notes. Notes.fn_topic is a > foreign key to topic.ft_id. > > If I would like to join its: > > Criteria criteria = new Criteria(); > criteria.addJoin(ForumnotesPeer.FN_TOPIC, ForumtopicPeer.FT_ID); > criteria.add (ForumnotesPeer.FN_ID, 1020); > List res = ForumnotesPeer.doSelect(criteria); > > Yes it select all of forumnotes fields, but doesn't selects forumtopic's > fields. > Ok, when I add named columns to criteria with: > criteria.addSelectColumn(ForumnotesPeer.FN_TEXT); > criteria.addSelectColumn(ForumtopicPeer.FT_NAME); > > its sql is: > select forumnotes.fn_text, forumtopic.ft_name from > forumnotes, forumtopic > where forumnotes.fn_id=1020 and > forumnotes.fn_topic=forumtopic.ft_id; > > yes, it is very good. > But res doesn't has forumtopic.ft_name value because > forumnotesPeer hasn't > any field named ft_name; > > How can I get fields of joined tables in result list? > > -- > thx, > ---------------------------------------------------- > Zoltan Zidarics programmer > PTE University Pecs, Hungary > icq: 43288694 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
