0 Replies Latest reply on Sep 14, 2007 10:05 AM by J-C jc

    Inheritance and proxy class

    J-C jc Apprentice

      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.

       C(extends B)

      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 ?