[jboss-user] [EJB 3.0] - Inheritance and proxy class

jc7442 do-not-reply at jboss.com
Fri Sep 14 10:06:09 EDT 2007


I have the following model:
A class A has a reference to a class B. B has several subclasses including C. Relation between A and B is Lazy.

When I get an A instance from the DB, I invoke the getB() method if A class and then I cast the B instance into C in order to invoke a method that only exists on C instance.

For B and C I use a Single inheritance.


  |   lazy
  | A---->B
  |      Î
  |      C(extends B)
  |      getX()
  | 


When I cast the getB() instance I have a ClassCastException because getB() is a javassist proxy instance on B and not on C. 

My workaround is to switch A/B relationship to EAGER but I really like to keep it lazy.

Is there some workaround for this proxy issue ? (that's the same issue with CGLIB). Is it a know bug ?


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084463#4084463

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084463




More information about the jboss-user mailing list