Announcement
Collapse
No announcement yet.
X
-
Hi aderosso,
yes, but customSQL lost you your pagination.
These two queries return the same for me:
Code:--EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON) select p.id as product_id , p.name as product_name , (select pc.name from t_productcategory pc where pc.id = p.productcategory_id and p.name like '%S%') as productcategory_name from t_product p; --EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON) select p.id as product_id , p.name as product_name , pc.name as productcategory_name from t_product p left outer join t_productcategory pc on pc.id = p.productcategory_id and p.name like '%S%';
Also, there is already OperationBinding.ansiJoinClause. I did not use it so far, though.
Best regards
Blama
Leave a comment:
-
Hi aderosso,
if there is no built-in way (don't think so) you can try this:
1) Analyze your query
2) No includeFrom fields in a.ds.xml, but instead:
Code:<field name="b_extradata" customSelectExpression="SELECT extradata FROM b WHERE a.id = b.id AND b.company_id = $criteria.fakeField" /> <field name="fakeField" customSelectExpression="null" />
Best regards
Blama
Leave a comment:
-
So I have 2 tables, A and B. Table A is the master set of data and B may or may not have a related record. I need to add a condition to the join. The ds.xml is based off of table B since those are the values it would be editing, Here's the query that works:
SELECT ... FROM A
LEFT JOIN B ON A.id = B.id AND B.company_id = ?
I got it working by using a customSQL, but then I lose paging which isn't ideal. If I could just override the table/join clause it would be great. Which I'm able to do as long as I don't includeFrom table A as that adds duplicated joins.
Leave a comment:
-
Could you clarify what you're trying to do? Are you trying to get rid of existing joins, add additional joins, something else?
Are you using DataSource.useAnsiJoins? This effects which clause is used for joins. See also operationBinding.includeAnsiJoinsInTableClause.
Leave a comment:
-
I tried that, but adding an incluleFrom field adds additional joins.
Leave a comment:
-
Join Clause
Is there a way to overwrite the join clause for a SQL data source? I'm looking for something similar to how tableClause, whereClause, etc works.Tags: None
Leave a comment: