persistence@glassfish.java.net

Re: Use same persistence unit in ejb and web tier

From: Sanjeeb Kumar Sahoo <Sanjeeb.Sahoo_at_Sun.COM>
Date: Wed, 25 Oct 2006 08:55:30 +0530

Can you please verify your ear file? To verify, either:
select your project node, right click, verify
or run in command prompt,
$GLASSFISH_HOME/bin/verifier <path to your ear file>

I am surprised that em is null. Are you using <persistence-context-ref>
or @PersistenceContext in your war file?

Thanks,
Sahoo
Benjamin Graf wrote:
> Hi Ian,
>
> one problem is still there. How can I access this global defined persistence unit. I tried an lookup,
>
> Context ctx = new InitialContext();
> em = (EntityManager) ctx.lookup("java:comp/env/persistence/LogicalName");
> persistence/LogicalName registered in web.xml
>
> but the EntityManager was null.
>
> Greets, Benjamin
>