mrszj / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

persist module is missing support for finders in concrete classes #653

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I've switched from warp-persist to guice-persist and see that for some reason 
finders on concrete classes are no longer working.

I couldn't find any information on the wiki, or through google on this topic. 
There must be a reason for it to be missing?

Anyway, it was easy enough to add. I'll add my code here for documentation 
purposes, should others have the same

(1) Create class PublicJpaFinderProxy extends JpaFinderProxy (in the same 
package)

(2) In the place where you install the JpaPersistModule, add:

// Install finder interceptor
Provider<EntityManager> provider = getProvider( EntityManager.class );
PublicJpaFinderProxy proxy = new PublicJpaFinderProxy( provider );
bindInterceptor( Matchers.any(), Matchers.annotatedWith( Finder.class ), proxy 
);

... which will behave exactly the same as the concrete finder support in 
warp-persist.

Original issue reported on code.google.com by basg81@gmail.com on 15 Sep 2011 at 9:26

GoogleCodeExporter commented 9 years ago

Original comment by sberlin on 20 Dec 2013 at 2:18