Gabriel,
If you can use Guice-Servlet, running it through PersistFilter will start
the persistence service.
Managing things this way is fantastically simple, and you get the benefit of
request-scoped EntityManagers if you inject a provider of these into your
servlets.
public class GuiceServletModule extends ServletModule {
@Override
protected void configureServlets() {
install(new JpaPersistModule("p1"));
filter("/*").through(PersistFilter.class);
serve("/gwtRequest").with(AppRequestFactoryServlet.class);
}
Best regards,
Will
On 16 June 2011 08:35, alex opn <[email protected]> wrote:
> Did you maybe forget to start it:
>
> Finally, you must decide when the persistence service is to be started by
> invoking start() on PersistService. I typically use a simple initializer
> class that I can trigger at a time of my choosing:
>
> public class MyInitializer {
>
> @Inject MyInitializer(PersistService service) {
>
> service.start();
>
> // At this point JPA is started and ready.
>
> }
> }
>
> I always bound it asEagerSingleton, so it gets started right when the
> bindings are being processed
>
>
> On Wed, Jun 15, 2011 at 8:44 PM, jMotta <[email protected]> wrote:
>
>> Gabriel,
>>
>> I've never used Guice Persist, but when I've used any type of provider,
>> including an entity manager provider, I had to bind it in a module, but once
>> you're installing this JpaPersistModule this probably should work.
>>
>> Apparently there is something related to initiate the persistence service
>> while using this JpaPersistModule, check this out in this
>> link<http://novyden.blogspot.com/2011/03/hibernate-persistence-with-jpa-using.html>
>> .
>>
>> Let us know if it helps you! :)
>>
>> *Jayr Motta*
>> Software Developer
>> *
>> *
>> I'm on
>> BlackBeltFactory.com<http://www.blackbeltfactory.com/ui#%21User/jmotta/ref=jmotta>
>> !
>>
>>
>>
>> On Wed, Jun 15, 2011 at 3:09 PM, Gabriel Cardelli <
>> [email protected]> wrote:
>>
>>> Hi,
>>> i'm trying to configure a app using Wicket + Guice 3.0 + Guice-Persist
>>> 3.0
>>>
>>> I Have a Module:
>>> public class EventosModule extends AbstractModule {
>>>
>>> public final static String persistenceUnit = "eventosImpa";
>>>
>>> public void configure() {
>>> install(new JpaPersistModule(persistenceUnit));
>>> }
>>>
>>> }
>>>
>>> Store:
>>>
>>> @Singleton
>>> public class EventoStoreImpl implements EventoStore {
>>>
>>> @Inject
>>> private Provider<EntityManager> entityManager;
>>>
>>> @Transactional
>>> public void save(Evento object) {
>>>
>>> entityManager.get().persist(object);
>>>
>>> }
>>> }
>>>
>>> When i try to execute my app i got this error:
>>>
>>> 1) No implementation for javax.persistence.EntityManager was bound.
>>> while locating
>>> com.google.inject.Provider<javax.persistence.EntityManager>
>>> for field at
>>>
>>> br.impa.apps.eventos.store.impl.EventoStoreImpl.entityManager(EventoStoreImpl.java:
>>> 21)
>>>
>>>
>>> Can anyone help me?
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "google-guice" group.
>>> 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-guice?hl=en.
>>>
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "google-guice" group.
>> 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-guice?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> 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-guice?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
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-guice?hl=en.