On 09/03/2010 06:13 AM, CasMeiron wrote:
> So I have 2 implementations of the EntityManagerWraper. Follow the PUA one:
> Caused by: java.lang.IllegalStateException: Unable to convert ejbRef for
> ejb PUAEntityManagerWrapper to a business object of type class
> package.BaseEntityManagerWrapper
>
> It's seems it try to cast the implementations to the base class? What Am
> I doin' wrong?
You're not doing anything wrong.
https://glassfish.dev.java.net/issues/show_bug.cgi?id=13040
As a workaround for the bug, you can:
- introduce wrapper methods in the concrete subclasses that call the
super() implementation. Netbeans' "insert overrides" makes this easy, if
ugly. That's what I've done.
- Use an @Local interface that does *NOT* extend any super-interface,
and implement that interface in your concrete EJBs:
interface Blah {
/// all your public "business" methods from
/// EntityManagerWrapper and PUAEntityManagerWrapper
}
@Stateless
@Local(Blah.class)
public class PUAEntityManagerWrapper
extends EntityManagerWrapper
implements Blah {
// methods
}
... and when you're using it, inject Blah not PUAEntityManagerWrapper:
public SomeClass {
@Inject private Blah puaEntityManagerWrapper;
}
--
Craig Ringer