The error in the title of this thread indicates that some counter in the ObjectDB file is unexpected. This could be caused, for example, if the database is stopped (abnormally) during a writing action, and recovery is not applied. However, it doesn't mean necessarily that there are issues in the database, and it is unclear if this has anything to do with the reported issue of no results in a query (post #3).
Regarding the query issue. Do you have it only in a specific deployment database, i.e. does the query work properly in development databases? Have you tried to fix the deployment database using the Doctor?
ObjectDB - Fast Object Database for Java (JPA/JDO)