This is nothing Hibernate can fix AFAICT. IMO the problem is with Weld, but as you can see from the related issue(WELD-2245), the Weld developers don't think that this is actually a problem. Maybe if more people speak up they will reconsider. Try to vote on that issue and comment on that issue. Every CDI bean class that offers an unwrap kind of method will eventually run into this problem. Concrete classes that might run into this that come to my mind are java.sql.Connection and java.sql.DataSource. If you make objects of these classes available as CDI beans you better make sure you implement a delegating wrapper of these interfaces and specially handle unwrap, otherwise you might end up with class cast exceptions. |