Great! Now everything works.

On May 17, 4:18 pm, Bálint Kriván <[email protected]> wrote:
> Please have a look at the following piece of codes:
>
> The ServiceLocator 
> implementation:https://github.com/messo/KFC/blob/master/kfc-war/src/main/java/hu/sch...
>
> <https://github.com/messo/KFC/blob/master/kfc-war/src/main/java/hu/sch...>
> EntityLocator:https://github.com/messo/KFC/blob/master/kfc-war/src/main/java/hu/sch...
> <https://github.com/messo/KFC/blob/master/kfc-war/src/main/java/hu/sch...>It's
> used for single entities.
>
> An example 
> RequestContext:https://github.com/messo/KFC/blob/master/kfc-war/src/main/java/hu/sch...
> <https://github.com/messo/KFC/blob/master/kfc-war/src/main/java/hu/sch...>Note
> the locator = BeanLocator stuff
>
> And the implementation which is an 
> EJB:https://github.com/messo/KFC/blob/master/kfc-ejb/src/main/java/hu/sch...
>
> <https://github.com/messo/KFC/blob/master/kfc-ejb/src/main/java/hu/sch...>It
> was working a several weeks ago with 2.2, I didn't checked with 2.3.
>
> 2011/5/17 andre.doelger <[email protected]>
>
>
>
>
>
>
>
>
>
> > Hi,
>
> > the example implementation is not really working. I've tried a
> > RequestFactory/EJB integration like this with GWT 2.3.
> > When findGroups() is called from a GWT client the EJB look-up via
> > BeanLocator is okay. But before GWT returns the objects to the client
> > it directly creates a instance of GroupManager and calls find() for
> > each returned object. The dependcy injection did not take place and
> > the EntityManager is null -> NullPointerexception.
>
> > What I do not understand:
>
> > 1. Why does the RequestFactory directly creates an instance of the
> > Locator and do not use the ServiceLocator?
> > 2. Why call find() for each entity that is returned in the List ->
> > Creates n+1 SQL calls
>
> > Regards,
>
> > André
>
> > On 2 Feb., 12:25, Bálint Kriván <[email protected]> wrote:
> > > Ok, I've found the problem:
>
> > > Using EJB bean for Locator implementation isn't good, because GWT
> > > instantiate it, so we have to make a EntityLocator, which lookups for the
> > > EJB and invoke the right methods. I hope this helps to the others!
>
> > > 2011/2/2 Bálint Kriván <[email protected]>
>
> > > > Hi!
>
> > > > Did anybody tried to use RequestFactory with EJB Beans using
> > > > Locator/ServiceLocator?
>
> > > > I'm having a little issue here.
>
> > > > My stateless session bean extends Locator<Group, Long>. For my
> > > > RequestContext I use a ServiceLocator which uses
> > InitialContext.doLookup();
> > > > to lookup the EJB (I can't use @EJB because the ServiceLocator instance
> > > > isn't container-managed -- btw. is there any solution for this? lookup
> > looks
> > > > ugly). Everything looks fine, but in my Bean, the entityManager
> > instance is
> > > > null (I'm using @PersistenceContext annotation on it) when GWT wants to
> > > > invoke find(Class<?>, Long) method: here I use simple em.find(). It's
> > > > strange because invoking from a servlet, using @EJB, it works fine.
> > What am
> > > > I doing wrong?
>
> > > > I've created a gist for it:https://gist.github.com/807082
>
> > > > So in this file:
> >https://gist.github.com/807082#file_group_manager.javaLine
> > > > #29, the em is null, but using this servlet:
> > > >https://gist.github.com/807082#file_test_servlet.javaitworks
> > perfectly.
>
> > > > Has anybody experience with this problem? I would like to use EJBs,
> > because
> > > > I would like to have JTA and Container-managed transactions. Thanks for
> > any
> > > > advice!
>
> > > > --
> > > > Regards,
> > > > Bálint Kriván
>
> > > --
> > > Üdv,
> > > Kriván Bálint
>
> --
> Üdv,
> Kriván Bálint

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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-web-toolkit?hl=en.

Reply via email to