According to the documentation here (under “unique results”) and here, A JDO “default” query result will return a List, and a “unique” specified query returns null if they are empty.
So am I safe to just use .isEmpty() to check that I got rows for a normal query? Likewise for those times that a query is marked “unique”, should I just use == null?
I tested and a empty result does indeed return a List with .size() of 0. So it seems my only danger of a NullPointerException lies with a “unique” query.
What other precautions should I take (if any)? Do I cover my bases acceptably with just those two types of checks? Pretty much looking for some best practice advice, and any potential gotcha’s. I am pretty novice with both Java and JDO/ORM persistence.
Thanks
Right way ? A List is a List and that has a Java contract (API). JDO doesn’t change that. Also the JDO spec (and DN docs) define what form of result comes from a query
http://www.datanucleus.org/products/accessplatform_3_0/jdo/jdoql_result.html