It's not expected by the spec to define an em on the entity. You'll need to pass
it to the method, or have it as a transient (Java transient is good enough)
variable that you set yourself.
Regards,
-marina
Markus KARG wrote:
> My JPA entity shall call one of it's NamedQueries. For that reasons, I
> wanted to add the following code to my entity:
>
> @PersistenceContext
> EntityManager em;
>
> But the verifier says, that is not working, since EntityManager is not
> serializable.
>
> So I added to it:
>
> @Transient
>
> But now the verifier says, that is not working, since
> @PersistenceContext must not be used together with @Transient.
>
> What can I do?
> How can my entity call it's own named query?
>
> Thanks
> Markus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net