Dmitriy Bereza
Dmitriy Bereza

Reputation: 53

Cannot perform operation ".isEmpty" on org.datanucleus.store.rdbms.sql.expression.SubqueryExpression

I have a subquery that looks like this: (It was rewrited from contains, because of perfomance issues)

...(select from RecoLock lock where mpiSubscriptionId == this.mpiSubscriptionId).isEmpty())

And datanucleus throws me a


Cannot perform operation ".isEmpty" on org.datanucleus.store.rdbms.sql.expression.SubqueryExpression


But in datanucleus documentation there are examples where similiar code workds well. What am I doing wrong?

datanucleus version is 4.1.0

Upvotes: 0

Views: 163

Answers (1)

Neil Stockton
Neil Stockton

Reputation: 11531

From what I see of the DataNucleus JDOQL support for {subquery}.isEmpty() this is only supported from v5.0.

If using v4.x (or earlier) you can transform your query to do

... (select COUNT(lock) from RecoLock lock where mpiSubscriptionId == this.mpiSubscriptionId) == 0)

which should equate to the same thing as "size == 0" (i.e "empty")

Upvotes: 2

Related Questions