Search code examples
javamysqldatasourcesmartgwt

Issue relating SmartGwt DataSources by using the includeFrom attribute


I'm trying to relate 2 smartgwt datasources by using the attributes "foreignKey" and "includeFrom".

<field name="payment_id" foreignKey="payment.id" />
<field name="payment_type" includeFrom="payment.type" />

Often a bill is not payed so it has no payment_id value. My problem is that when I use that DS to fetch bills only the payed bills are fetched because by default smartgwt will do a Inner Join.

In order to solve that problem I researched a bit and I found that It's possible to change the join used by setting the joinType attribute.

<field name="payment_id" foreignKey="payment.id" joinType="outer" />
<field name="payment_type" includeFrom="payment.type" />

But, I get the same results...

What I'm doing wrong? Someone has an idea?


Solution

  • Just in case someone has this problem too.

    Coffee in hand and deeply reading the explanation of how joinType works I found one interesting note:

    Note, outer joins (see joinType) only work with certain database products if you choose not to use ANSI joins. Other than that, the join strategies are equivalent.

    So I looked what this ANSI joins are and I found that in order to make the whole thing work It's required to set server.properties flag sql.useAnsiJoins to true.

    Now works!