Author: doogie
Date: Fri Nov 13 09:35:52 2009
New Revision: 835790
URL:
http://svn.apache.org/viewvc?rev=835790&view=revLog:
Example of relations.
Modified:
ofbiz/trunk/framework/webslinger/websites/webslinger/www/TestSQL.groovy
Modified: ofbiz/trunk/framework/webslinger/websites/webslinger/www/TestSQL.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webslinger/websites/webslinger/www/TestSQL.groovy?rev=835790&r1=835789&r2=835790&view=diff==============================================================================
--- ofbiz/trunk/framework/webslinger/websites/webslinger/www/TestSQL.groovy (original)
+++ ofbiz/trunk/framework/webslinger/websites/webslinger/www/TestSQL.groovy Fri Nov 13 09:35:52 2009
@@ -19,6 +19,9 @@
c.groupName
FROM
Party a LEFT JOIN Person b ON a.partyId = b.partyId LEFT JOIN PartyGroup c on a.partyId = c.partyId
+RELATION TYPE one Party ON cur.partyId = other.partyId
+RELATION TYPE one Person ON cur.partyId = other.partyId
+RELATION TYPE one PartyGroup ON cur.partyId = other.partyId
WHERE
partyId = 'admin'
ORDER BY
@@ -34,6 +37,10 @@
def gv;
while ((gv = eli.next()) != null) {
response.writer.println("gv=$gv<br />")
+ def party = gv.getRelatedOneCache('Party')
+ def person = gv.getRelatedOneCache('Person')
+ response.writer.println("\tparty=$party<br />")
+ response.writer.println("\tperson=$person<br />")
}
} finally {
if (eli != null) eli.close()