Comment by pmmi...@gmail.com:

Would look to add something for newcomers like me. Don't know how obvious or not this is (it wasn't for me), but if you instantiate MyService MANUALLY your EntityManager will be null and calls will throw NullPointerException. Since we are using Guice already, just create a new module which you can add after MyModule when you call createInjector

public class ServiceModule extends AbstractModule {
        @Override
        protected void configure() {                    
                bind(Service.class).to(MyService.class);                        
        }
}

For more information:
http://code.google.com/p/google-guice/wiki/JPA

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to google-guice-dev@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en.

Reply via email to