0 Replies Latest reply on Jun 24, 2011 5:27 AM by ben_utzer

    EntityIdentifierStrategy fails with proxy objects

    ben_utzer

      Hi,


      we have a problem that revolves around EntityQuery, Javassist proxies and EntityIdentifierStrategy.
      There is one case in our code where the resultlist of an entityquery contains javassist proxy objects. It's peculiar that it's always the same two objects which get proxied and then returned in the list. The problem is there is nothing special about these objects compared to the other ones in the result list.


      Could anyone shed some light on when Seam returns proxy objects in result lists?


      The followup problem that results from the proxy objects being in the list is that hasPermission does not work correctly on proxy objects because IdentifierPolicy calls s.canIdentify(target.getClass()) on all registered strategies and the default EntityIdentifierStrategy will return false because it cannot find the @Entity annotation on the proxy class. This problem can only be solved by registering a custom IdentifierStrategy where the superclass of the proxy class is asked about the @Entity annotation.


      I hope I've made myself clear enough if not I'll be happy to provide further information.


      Regards,


      Ben