Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2632

Allow unwrapping of a proxied object

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • None
    • None
    • None

      This is a revival of https://issues.redhat.com/browse/WELD-2245 and https://hibernate.atlassian.net/browse/HHH-11020 for reconsideration.

      I am not asking for change in default behaviour but to give developer the power to override it.

      The setup with injected EntityManager and unwrapping the instance is quite common so I don't think it is fair to require custom workarounds for this. I understand the logic why Weld is safeguarding this to prevent escape from proxy but there are use cases like this one in JPA where you do actually want the underlying instance. I think there should be a way to tell Weld to let us do this while keeping the defaults.

      Something like (making this up on the fly):

      @JustLetMeUnwrap Session session = em.unwrap(Session.class);

       

      ..or any developer convenient way to override the default behaviour when needed.

       

      This would also appear to be a blind spot in JPA/CDI interop at the spec level so clarification there would also be welcome.

       

            Unassigned Unassigned
            cen.is.imba@gmail.com Klemen Ferjancic (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: