java - Spring Data Mongo Null Query -


i have basic query in dao:

        query query = new query(criteria.where("userid").is(userid));         program userprogram = mongotemplate.findone(query, program.class); 

i have basic pojo gets , sets class document annotation...very basic.

in example how coalesce , return default user object if there no user? there best practice (aka nullpointer exception checking in service?)


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -