I have noticed that the Hibernate*.java#getObjectByUuid default implementation is failing with ‘org.hibernate.QueryException: could not resolve property: uuid …’ error after investigating a chartsearch failure, see sample full log at: http://pastebin.com/nVbZBEFj. Though still looking into a possible solution, i have not yet found one and so decided to write to the devs for suggestions to quicken up my solving time!
Do you have a unit test reproducing the problem?
Not yet, testing on a live database
My first guesses are that either (a) you don’t have a mapped uuid property
on ChartSearchBookmark, or (b) you never set the :uuid property of the
query in code.
IT was working well before but i was encountering:
so i removed the property reference in the complaining entities, the uuid property is provided by the super class BaseOpenmrsObject, i tried different property naming such that i refer the property values to the getUuid of the super class but couldn’t help.
I have investigated this issue clearly and it looks like the base/super (BaseOpenmrsObject) class fails to avail the uuid property(field not column) to hibernate as being part of the subclass properties which makes it to throw
org.hibernate.QueryException: could not resolve property: uuid when accessing uuid property under the hibernate session.createQuery(String arg0) method. I just wouldn’t tell why it is happening like this, i have also tried overriding the attribute but it would likewise fail with the same error and that’s how i came to understand that this may be an issue with hibernate.
For now i have just removed BaseOpenmrsObject from being a super class to my persisted classes which solves the issue, i leave up this discussion as a follow up investigation for this issue while using JPA annotated mapping.
Ah yes, I have seen this before: it doesn’t work to mix JPA annotation with
xml-defined hibernate mappings in this way.
The workaround AFAIK is to create your own BaseJpaAnnotatedOpenmrsObject
and extend this instead of BaseOpenmrsObject.
(We should add this to openmrs-core also.)