I solved and post the patch to commit, please the solution in http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=1750208

Cl�vis Wichoski wrote:

Hi,

I'm getting wrong results when executing a Query with Criteria that uses path expression for extent with Multiple Joined Tables:

The QueryByCriteria from class myproject.User where [myCompany.shortcut = COMPANYX, [login = UserX]]

The expected result is that returns only the User of COMPANYX with login UserX, but this results in ALL login equals UserX, the OR part in SQL generate the wrong result, because the field shortcut exists only in superclass Person

In list archives I found some messages that may make sense for this error:

http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=7587 maybe

that says "..if no field is found the name from the criteria is used.." but for the multiple joined extend this must be false, or my mappings are wrong?

and maybe this message started this trouble with multiple joined tables:

http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=612081


Follow the part of trace I'm getting here:

...
[org.apache.ojb.broker.core.PersistenceBrokerImpl] DEBUG: Creating RsIterator for class [myproject.User]
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeQuery : QueryByCriteria from class myproject.User where [myCompany.shortcut = COMPANYX, [login = UserX]]
[org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] DEBUG: TableAlias(): using hints ? false
[org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] DEBUG: TableAlias(): using hints ? false
[org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] DEBUG: TableAlias(): using hints ? false
[org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] DEBUG: TableAlias(): using hints ? false
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result of getTableAlias(): PERSON A1
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.VERSION,A0.STATUS,A0.PASSWORD,A0.LOGIN,A0.OID,A0.MY_COMPANY,A0.MY_EMPLOYEE FROM USER A0,PERSON A1,EMPLOYEE A1E0,COMPANY A1E1 WHERE A0.MY_COMPANY=A1.OID(+) AND A0.MY_COMPANY=A1E0.OID(+) AND A0.MY_COMPANY=A1E1.OID(+) AND (( (A1.SHORTCUT = ? OR shortcut = ? OR shortcut = ?)) AND (A0.LOGIN = ?))
...


but the correct SQL is:
SELECT A0.VERSION,A0.STATUS,A0.PASSWORD,A0.LOGIN,A0.OID,A0.MY_COMPANY,A0.MY_EMPLOYEE FROM USER A0,PERSON A1,EMPLOYEE A1E0,COMPANY A1E1 WHERE A0.MY_COMPANY=A1.OID(+) AND A0.MY_COMPANY=A1E0.OID(+) AND A0.MY_COMPANY=A1E1.OID(+) AND (( (A1.SHORTCUT = ? ) AND (A0.LOGIN = ?))


I'm using a compiled CVS checkout of version 1.0, with a SapDB database.

TIA

Cl�vis


--------------------------------------------------------------------- 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]



Reply via email to