hi
i want to make a view-entity like this: select a.fkey , a.fdesc , b.fname , c.faddr , d.ftel from a left join b on a.fkey = b.fkey left join c on a.fkey = c.fkey left join d on a.fkey = d.fkey where a.fkey = b.fkey and b.fkey = c.fkey and c.fkey = d.fkey then i write this: <view-entity entity-name="ViewAll" package-name="org.ofbiz" > <member-entity entity-alias="TA" entity-name="a"/> <member-entity entity-alias="TB" entity-name="b"/> <member-entity entity-alias="TC" entity-name="c"/> <member-entity entity-alias="TD" entity-name="d"/> <alias-all entity-alias="TA" /> <alias-all entity-alias="TB" /> <alias-all entity-alias="TC" /> <alias-all entity-alias="TD" /> <view-link entity-alias="TA" rel-entity-alias="TB"> <key-map field-name="fKey"/></view-link> <view-link entity-alias="TA" rel-entity-alias="TC"> <key-map field-name="fKey"/></view-link> <view-link entity-alias="TA" rel-entity-alias="TD"> <key-map field-name="fKey"/></view-link> <relation type="one" rel-entity-name="TA"> <key-map field-name="fKey"/> </relation> <relation type="one" rel-entity-name="TB"> <key-map field-name="fKey"/> </relation> <relation type="one" rel-entity-name="TC"> <key-map field-name="fKey"/> </relation> <relation type="one" rel-entity-name="TD"> <key-map field-name="fKey"/> </relation> </view-entity> but , can't work, no where condition in sql string , so the result very big , and not left join how ? thx. |
Administrator
|
I don't know if you got through it but referring to http://en.wikipedia.org/wiki/Join_(SQL)#Left_outer_join a left join is also
called a left outer join. To get an outter join in OFBiz you must use rel-optional= true (by default it's false). Look for example in code... Also be sure to use <relation> in a view-entity when you really need it Jacques From: "stamilo" <[hidden email]> > hi > i want to make a view-entity like this: > select > a.fkey , a.fdesc , > b.fname , > c.faddr , > d.ftel > from > a left join b on a.fkey = b.fkey > left join c on a.fkey = c.fkey > left join d on a.fkey = d.fkey > where > a.fkey = b.fkey > and > b.fkey = c.fkey > and > c.fkey = d.fkey > > then > i write this: > > <view-entity entity-name="ViewAll" package-name="org.ofbiz" > > <member-entity entity-alias="TA" entity-name="a"/> > <member-entity entity-alias="TB" entity-name="b"/> > <member-entity entity-alias="TC" entity-name="c"/> > <member-entity entity-alias="TD" entity-name="d"/> > <alias-all entity-alias="TA" /> > <alias-all entity-alias="TB" /> > <alias-all entity-alias="TC" /> > <alias-all entity-alias="TD" /> > <view-link entity-alias="TA" rel-entity-alias="TB"> <key-map > field-name="fKey"/></view-link> > <view-link entity-alias="TA" rel-entity-alias="TC"> <key-map > field-name="fKey"/></view-link> > <view-link entity-alias="TA" rel-entity-alias="TD"> <key-map > field-name="fKey"/></view-link> > <relation type="one" rel-entity-name="TA"> > <key-map field-name="fKey"/> > </relation> > <relation type="one" rel-entity-name="TB"> > <key-map field-name="fKey"/> > </relation> > <relation type="one" rel-entity-name="TC"> > <key-map field-name="fKey"/> > </relation> > <relation type="one" rel-entity-name="TD"> > <key-map field-name="fKey"/> > </relation> > </view-entity> > > > but , can't work, no where condition in sql string , > so the result very big , and not left join > > how ? > > thx. > |
thx!
there is some error data in my database :) On Thu, Jun 26, 2008 at 7:55 PM, Jacques Le Roux < [hidden email]> wrote: > I don't know if you got through it but referring to > http://en.wikipedia.org/wiki/Join_(SQL)#Left_outer_join<http://en.wikipedia.org/wiki/Join_%28SQL%29#Left_outer_join>a left join is also > called a left outer join. To get an outter join in OFBiz you must use > rel-optional= true (by default it's false). Look for example in code... > Also be sure to use <relation> in a view-entity when you really need it > > Jacques > > From: "stamilo" <[hidden email]> > > hi >> i want to make a view-entity like this: >> select >> a.fkey , a.fdesc , >> b.fname , >> c.faddr , >> d.ftel >> from >> a left join b on a.fkey = b.fkey >> left join c on a.fkey = c.fkey >> left join d on a.fkey = d.fkey >> where >> a.fkey = b.fkey >> and >> b.fkey = c.fkey >> and >> c.fkey = d.fkey >> >> then >> i write this: >> >> <view-entity entity-name="ViewAll" package-name="org.ofbiz" > >> <member-entity entity-alias="TA" entity-name="a"/> >> <member-entity entity-alias="TB" entity-name="b"/> >> <member-entity entity-alias="TC" entity-name="c"/> >> <member-entity entity-alias="TD" entity-name="d"/> >> <alias-all entity-alias="TA" /> >> <alias-all entity-alias="TB" /> >> <alias-all entity-alias="TC" /> >> <alias-all entity-alias="TD" /> >> <view-link entity-alias="TA" rel-entity-alias="TB"> <key-map >> field-name="fKey"/></view-link> >> <view-link entity-alias="TA" rel-entity-alias="TC"> <key-map >> field-name="fKey"/></view-link> >> <view-link entity-alias="TA" rel-entity-alias="TD"> <key-map >> field-name="fKey"/></view-link> >> <relation type="one" rel-entity-name="TA"> >> <key-map field-name="fKey"/> >> </relation> >> <relation type="one" rel-entity-name="TB"> >> <key-map field-name="fKey"/> >> </relation> >> <relation type="one" rel-entity-name="TC"> >> <key-map field-name="fKey"/> >> </relation> >> <relation type="one" rel-entity-name="TD"> >> <key-map field-name="fKey"/> >> </relation> >> </view-entity> >> >> >> but , can't work, no where condition in sql string , >> so the result very big , and not left join >> >> how ? >> >> thx. >> >> > |
Free forum by Nabble | Edit this page |