Consider a Cat object like this (pseudocode):
@Entity
class Cat {
@Id
Long id;
@Column
String name;
@Column
String size;
@OneToMany
List<Cat> offsprings;
}
This is an HQL query that looks for kittens of size "TINY"
from Cat c join c.offsprings o where o.size = 'TINY'
explode with
ERROR: Invalid input syntax for integer: "TINY"
because size- this is a special property name, which in this case counts the number of descendants of cats.
In a scenario like this, is there a proper way to force Hibernate to heal o.size(or perhaps o.classothers) as a regular property name?
(1) I am not the author of this sad design, and I cannot indulge it. However, I cannot change it at the moment.
prook source
share