Hi
Starting up a new project using *RF* and *guice-persist* on the server-side
to start JPA and provide transaction management.
I have a couple of tests going to inject the EntityManager into the services
via the ServiceLocator :
public class *ApplicationServiceLocator* implements ServiceLocator {
Injector injector = null;
public ApplicationServiceLocator() {
injector = Guice.createInjector(new JpaPersistModule("Test"));
injector.getInstance(ApplicationInitializer.class);
}
@Override
public Object getInstance(Class<?> clazz) {
*return injector.getInstance(clazz);*
}
}
This makes sure that is EntityManager injected into the service layers :
public class *WorkerServiceImpl* {
*@Inject*
*private EntityManager em;*
@Transactional
public List<Contract> getContracts(User user) {
*// I can us EntityManager now !! Injected because created this
WorkerServiceImpl
was created via injector.getInstance
* }
My question : what would be a good approach to inject the EntityManager into
an entity class when implementing a service in an entity class ?
What hooks do I have available to do so ?
thx
Koen
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/CDzbDvioxCAJ.
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-web-toolkit?hl=en.