You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Reinis Vicups <op...@orbit-x.de> on 2013/06/18 01:58:10 UTC

"Unwrapping" enhanced entity

Hello,

I would like to pass an enhanced entity 
(org.apache.openjpa.util.com$MyClass$0$proxy) to an 3rd party framework 
that does some reflection stuff. In particular, that framework does 
myEntity.getClass().getFields().

According to spec (read it someplace in oracle docs) - proxy shall 
return a null array when getFields() is being invoked. This is also 
happening in my case.

The 3rd party framework fails since it does not find any fields.

I am looking now for a good practice on how to "unwrap" the entity or 
modify that 3rd party framework in a way that I get access to the 
original field array of com.MyClass.

myEntity.getClass.getGenericSuperclass() returns the right type 
(com.MyClass) but I am unsure on if and how to instrumentalize this.

I'd greatly appreciate any hints on this one.

kind regards
reinis