No you certainly don't need to bind PersistenceService yourself, it
should be available to the injector once you pass in the module from
PersistenceService.usingJpa()..buildModule(). I'm not sure I can tell
what is happening from the code you have--can you post the entire Main
class including the go() method?
I tried this quick and dirty test and it worked for me:
injector = Guice.createInjector(
new AbstractModule() {
protected void configure() {
//tell Warp the name of the jpa persistence unit
bindConstant().annotatedWith(JpaUnit.class).to("testUnit");
}
},
PersistenceService.usingJpa()
.across(UnitOfWork.TRANSACTION)
.transactedWith(TransactionStrategy.LOCAL)
.buildModule());
//startup persistence
injector.getInstance(PersistenceService.class)
.start();
There isn't anything different here to your code, semantically. So I'm
not sure what it is. I even tried a version with the InitializerJpa
exactly as you have it. One thing you could try is looking at the
warp-persist unit tests and compare if you are doing anything
differently?
As you say it may be the newer snapshot of Guice, I will grab it and
re-test to make sure. To be on the safe side, can you try it with
Guice 1.0? The latest source versions appear to be unstable..
Dhanji.