Java Mailing List Archive

http://www.gg3721.com/

Home » users.openjpa »

"Unwrapping" enhanced entity

Reinis Vicups

2013-06-17


Author LoginPost Reply
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
©2008 gg3721.com - Jax Systems, LLC, U.S.A.