| See the attached unit test. Generally, when working with a HibernateProxy object and using that object to retrieve a related entity which is related through the "any" mapping, then the related entity is not found. For clarity the unit test contains three cases:
- the entity is retrieved though related object which is not a proxy (succeeds)
- the entity is retrieved though related object which is a proxy but which has been unproxied (succeeds)
- the entity is retrieved though related object which is a proxy (fails)
The problem only occurs if the relation is mapped through "any", whereas mapping with "many-to-one" works. |