I think dynamic finders is a smashing idea.
I am having couple of problems with getting this to work.
1. SVN check out of warp does not checkout the code completely.
This is the error i get.
A warp-persist/warp-persist/lib/hsqldb.jar
svn: REPORT request failed on '/svn/!svn/vcc/default'
svn: REPORT of '/svn/!svn/vcc/default': 200 OK (http://warp-
persist.googlecode.com)
Fortunately warp/dist is checked out by this time and this directory
has the warp-persist.jar, so I can still hack on...
2. (This problem may be Guice related and not Warp related. I am new
to Guice also, so please bear with me.)
I code up a simple Entity, setup persistence.xml in META-INF in the
classpath.
Next I create a module to bootstrap the persistence unit and start
JPA
public class Startup extends AbstractModule
{
public static void main(String[] args)
{
Injector injector = Guice.createInjector(new Startup());
EntityA person = new EntityFinder().createNewPerson();
System.out.println("person = " + person);
}
protected void configure()
{
bindConstant().annotatedWith(JpaUnit.class).to("warp-
persistence-unit");
Injector injector = Guice.createInjector(
PersistenceService.usingJpa()
.buildModule());
}
@Singleton
public class MyInitializer {
@Inject MyInitializer(PersistenceService service) {
System.out.println("Startup$MyInitializer.MyInitializer About
to start JPA");
service.start();
//at this point JPA is started and ready
}
}
}
But when i run this I get a run time error :
Exception in thread "main" com.google.inject.CreationException: Guice
configuration errors:
1) Error at com.wideplay.warp.jpa.JpaPersistenceService.<init>(Unknown
Source):
Binding to java.lang.String annotated with
@com.wideplay.warp.jpa.JpaUnit() not found. No bindings to that type
were found.
1 error[s]
at com.google.inject.BinderImpl.createInjector(BinderImpl.java:277)
at com.google.inject.Guice.createInjector(Guice.java:79)
at com.google.inject.Guice.createInjector(Guice.java:53)
at com.google.inject.Guice.createInjector(Guice.java:43)
at warp.Startup.configure(Startup.java:36)
What am i doing wrong ?
bindConstant().annotatedWith(JpaUnit.class).to("warp-
persistence-unit");
does happen before
Injector injector = Guice.createInjector(
PersistenceService.usingJpa()
.buildModule());
Why is Guice not able to pick this binding up ?
Thank you.
-Prashant
@com.wideplay.warp.jpa.JpaUnit () not found. No bindings to that type