do you see the persistent elements in DB? Can you see the elements if you change FetchType.LAZY to EAGER?
2011/2/2 JB <[email protected]>: > Hi, > > I'm having troubles in using collection (list) of entities with > requestFactory. > > The persistence of the whole graph is OK, but whenever I try to > retrieve it, it shows no embedded element. > > There is obviously something wrong in my code, but I cannot figure > out... > I couldn't find any clear explanation nor a workaround. > > Here is my code: > > ------------------------------------------- > > //class declaration > public class Container{ > > @OneToMany(fetch = FetchType.LAZY) > private List<Element> elements; > } > (getter/setters automatically generated with Roo) > > > //creation > ContainerRequest context = requestFactory.containerRequest(); > elementProxy element = context.create(ElementProxy.class); > ContainerProxy container = context.create(ContainerProxy.class); > > List<ElementProxy> list = new ArrayList<ElementProxy>(); > list.add(element); > container.setId("foo"); > container.setElements(list); > context.persist().using(container).fire(); > //so far, so good.... I got an Element created, and a container > > //retrieval > ContainerRequest requestGetContainer = > requestFactory.containerRequest(); > Request<ContainerProxy> getcontainer = > requestGetContainer.findContainer("foo").with("elements"); > Receiver<ContainerProxy> callback = new Receiver<ContainerProxy>(){ > public void onSuccess(ContainerProxy result) { > System.out.println("nb elements: " + > result.getElements().size()); > }}; > callback.fire(); > > ------------------------------------------- > as a result, the list of elements is empty.... > > Any help/tip welcomed on that..... > > > > > > -- > 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. > > -- 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.
