Misleading Hibernate Error Messages
I recently ran across the error “unable to find parameter [x]” where “x” was clearly defined in the list of parameters for findByNamedParam.
My first step was to remove the parameters and just try to grab the whole table, something like “from mytable”. This resulted in “no persistent classes for query class”. Again, the classes definitely exist and are correctly referenced in the mapping.
Then I re-added the hibernate mapping xml file to the project config. (It was already mentioned, but appeared a little different than used successfully elsewhere so I clobbered the whole mapping section and re-entered it). This resulted in a number of syntax errors in the xml file.
Once the xml syntax errors were cleared up I was able to retrace the coding to correctly locate the records of interest.
So, whenever you get a message from hibernate that is even remotely vague assume something else is wrong that it forgot to tell you about, but it is being nice enough to tell you something is wrong.
