I've created a few of my own annotations that my application uses reflectively at runtime. However, when I have a mapped pojo that gets proxied, I lose the ability to discover my annotations because getClass() returns the proxied class type, not the underlying class type.
I've been using Hibernate.getClass(proxiedClass) to work around the issue, but this is starting to introduce Hibernate classes into layers of my application that do not have to be aware of persistence concerns. From my point of view, if hibernate proxies a class, that should not unduly impact the application using that proxied class.
Unfortunately annotations don't have any real inheritence mechanism. Does anyone have any thoughts about this?
One thing that I can think of would be that somehow proxied classes have their annotations copied over during the proxy process.
Any thoughts or pointers are appreciated.
-Erik
P.S. I realize that strictly speaking, this is more a CGLIB and general Hibernate problem and not specific to EJB3/Hibernte Annotations.
|