users@glassfish.java.net

Re: Putting EntityManagerFactory into JNDI

From: <glassfish_at_javadesktop.org>
Date: Wed, 23 Jan 2008 11:40:06 PST

I'll answer this post, but the discussion here is getting awfully sidetracked towards some unrelated issues.

> I'm a little dense, I admit that, but just what are
> you going to annotate to get Glassfish to inject a
> reference to the EntityManagerFactory.

Why should I have to annotate anything? A property in persistence.xml (the JBoss way) or in some other .xml file should be enough. And I don't need the EntityManagerFactory to be injected, that's the point. I need it in JNDI so that any code running in Glassfish can look it up any time.

> So I guess I'm still unclear on how you say that
> Glassfish "creates" the EMF for you.

Who creates the EntityManagerFactory for my application then, if not Glassfish?

> Where in your
> application does Glassfish create this and how do you
> get a hold of it?

Of course my application doesn't create the EMF. Where Glassfish creates this, I don't know since I'm not familiar with Glassfish source code, but that's not the problem we're discussing now, is it?

> From an EJB point of view, the EntityManagerFactory
> (and EntityManager) are available when inside the
> EJB, but I cannot find anywhere that it is specified
> where it is "created".

What I need is for EMF to be available *outside* of EJB invocations. So the EJB point of view doesn't interest me here.
[Message sent by forum member 'koser' (koser)]

http://forums.java.net/jive/thread.jspa?messageID=255440