[weld-issues] [JBoss JIRA] (WELD-2632) Allow unwrapping of a proxied object

2020-07-27 Thread Klemen Ferjancic (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Klemen Ferjancic commented on  WELD-2632  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Allow unwrapping of a proxied object   
 

  
 
 
 
 

 
 Yes, that works, I am just unhappy by the need to write wrappers/utility code instead of using JPA interface as intended. A few more thoughts   

 

@AllowUnwrap
@Inject
private EntityManager em 

 however, doing it at injection point is probably the wrong place, so how about at producer:   

 

@AllowUnwrap
@Produces
@RequestScoped
public EntityManager getEntityManager(){}
 

 As a bonus, weld behaviour could be codified in the spec and this would allow a developer override. No other code changes needed when using JPA or similar use cases.     I'm sure it is a bit more complicated that that and I also understand this is a rather narrow use case to merit an introduction of a new annotation/funcitonality in CDI. It seems cleaner and doable though. It would probably make more sense to start this discussion at the spec level. Feel free to close the issue as needed.    
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v7.13.8#713008-sha1:1606a5c)  
 
 

 
   
 

  
 

  
 

   


[weld-issues] [JBoss JIRA] (WELD-2632) Allow unwrapping of a proxied object

2020-07-27 Thread Martin Kouba (Jira)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Martin Kouba commented on  WELD-2632  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Allow unwrapping of a proxied object   
 

  
 
 
 
 

 
 Since Weld 3.x you can cast a client proxy instance to org.jboss.weld.proxy.WeldClientProxy and obtain the contextual instance via proxy.getMetadata().getContextualInstance(). I believe that this approach is "good enough" for similar use cases.   
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v7.13.8#713008-sha1:1606a5c)  
 
 

 
   
 

  
 

  
 

   

___
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues