thinking defensively, in a pathological scenario, the data and/or schema of the database could be corrupt
eg. using a named query that should return a single entity based on a unique constraint of a table:
- what if the unique constraint was implemented incorrectly in the ddl? (too relaxed or too strict)
- what if the data became inconsistent as a result of some external process?
=> should always code defensively, especially at integration points to anything external to the jvm
even if you deploy your application in a Servlet or EJB container, there are still compelling reasons to use Shiro's Session support instead of the container's