On Tue, Sep 2, 2008 at 11:31 AM, rcouto <[EMAIL PROTECTED]> wrote:

>
> Hi, Elek,
>
> If I got your problem right (in other words, to inject persistence
> context into EJBs) I think you don't need to scan all your bean
> classes and parameters for it. You should start by parsing the
> persistence.xml of the module and instantiate all the needed
> EntityManagers (and EntityManagerFactories). By then, you should have
> a map from P.U. names to implementations. Next, you probably would
> need to code a class that receives the Binder (the guice part) of the
> module and add bindings for the persistence contexts, just like Simone
> suggested. So, in the end, the client (or your container to be, if
> that's the case) should set up a Module using this class to help with
> the bindings. The same logic could be applied to other injections
> (@Resource, @UserTransaction, iirc).


No, you definitely need to scan the classpath and reflectively look for
@PersistenceContext. Guice will not inject anything that doesn't have an
@Inject and it will ignore ejb annotations.

This is how Seam and JBoss's EJB container work, for instance.

Note that you can use warp-persist as a bridge to manage your hibernate/jpa
setup if you *really* want to go down the painful path of writing your own
EJB container. Strictly speaking, without the scholarship program (or being
a commercial licensee) you aren't legally allowed to implement Java EE
specs, either.

Dhanji.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to