]
Joonas Koivunen commented on ANN-796:
-------------------------------------
Another note that should be added is that all the interfaces described in the inheritance
tree with @Proxy will be proxied by each and every object.
A ClassCastException with bad message will be thrown if the object doesn't actually
implement the interface.
Could the ClassCastException message be modified to something more verbose than the actual
class name of the proxied object is? It took a rather long time for me to figure from
where the exception was thrown and why.
@Proxy annotation's reference documentation needs to improved
-------------------------------------------------------------
Key: ANN-796
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-796
Project: Hibernate Annotations
Issue Type: Improvement
Components: documentation
Affects Versions: 3.4.0.GA
Environment: Core 3.3.1.GA, Apache Derby
Reporter: Joonas Koivunen
Original Estimate: 1 day
Remaining Estimate: 1 day
I stumbled upon the problem documented for example here:
http://www.hibernate.org/250.709.html, that you cannot just ask for the super-class and
expect a child class' instance, even if for example toString() gives the correct
answer.
In
http://www.hibernate.org/hib_docs/v3/reference/en/html/performance.html#p...
the use of
<sub-class class="..." proxy="...">...</subclass>
is documented. From that I realized that was this @Proxy annotation that I never thought
of using before.
Looking at
http://www.hibernate.org/hib_docs/annotations/reference/en/html/entity.ht...
that documents @Proxy:
1) It talks about proxyClassName attribute, which doesn't exist (any more at least),
it has been replaced with Class<?> proxyClass
2) It doesn't mention anything about you having to annotate every class in the
hierarchy from Cat to DomesticCat with
@Proxy(proxyClass=BusinessInterfaceForEachClass.class)
If not all of the hierarchy are annotated with @Proxy it'll throw a MappingException
complaining that proxyClass is not an interface or the class itself, which doesn't
quite translate to "you need to annotate whole hierarchy." Is this error because
of some defaulting to void.class in the upper hierarchy perhaps?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: