user
11/28/2025, 1:13 PMinList("property", mySubQuery) I'm given an error:
ConverterNotFoundException: No converter found capable of converting from type [org.hibernate.criterion.DetachedCriteria] to type [java.lang.Long]
This is usually when there is some nesting of associations, but I haven't been able to extract a simple reproducible case from our application.
The issue arises in AbstractHibernateCriterionAdapter as follows
protected void applySubCriteriaToJunction(PersistentEntity entity, AbstractHibernateQuery hibernateCriteria, List<Query.Criterion> existing,
Junction conjunction, String alias) {
for (Query.Criterion subCriterion : existing) {
if (subCriterion instanceof Query.PropertyCriterion) {
Query.PropertyCriterion pc = (Query.PropertyCriterion) subCriterion;
if (pc.getValue() instanceof QueryableCriteria) {
pc.setValue(toHibernateDetachedCriteria(hibernateCriteria, (QueryableCriteria<?>) pc.getValue()));
}
else {
AbstractHibernateQuery.doTypeConversionIfNeccessary(entity, pc);
}
}
Here, pc.getValue() is an already converted Hibernate DetatchedCriteria, not the original Gorm DetachedCriteria - it looks like the gorm original has been converted, but I've yet been unable to trace where and when.
the Hibernate converted DC is not instanceof QueryableCriterion and so the engine looks instead to convert to a list of scalars.
Does anyone have any initial thoughts on bug/limitation or feature here?Steve Osguthorpe
11/28/2025, 1:51 PMpc.setValue(toHibernateDetachedCriteria(hibernateCriteria, (QueryableCriteria<?>) pc.getValue())); mutates the original, any subsequent usage would cause the error you are seeing.
I don't think the "why" it was already converted is really important here though, if it CAN happen then this code should be changed to accommodate that and skip values already of the Hibernate Criteria types, I think you should file a bug.