Re: Currently do not support adding restriction on discriminator for table


Page bloom
 

Presumably the warning is indicating a possible "non optimal performance" SQL query rendered from the JDOQL. If a WHERE clause of discriminator conditions are left out then the range of records the DB must scan is likely much larger for most types of queries.

So I assume what is supported is a WHERE clause of discriminator classId=x conditions only in the case of a query's candidate class.
What is not supported is generating a WHERE clause of discriminator classId=x conditions for a relationship of the candidate class, the kind that might be generated by something like:


q.setFilter("relation instanceof MyClassB && ((MyClassB)relation).attributeOfB != null")

I guess SQL isn't Java so even though the JDOQL can be Java like it's constrained.

Perhaps a nested JDOQL query might work better here? Hmmmm

Join main@datanucleus.groups.io to automatically receive all group messages.