Hello Mauro Personally i try to ensure i eagerly featch these relationships with a jpql query when possible. If really not possible using a @Stateful bean with an EXTENDED persistence context can help.
Le 17 nov. 2016 07:46, "mauro2java2011" <[email protected]> a écrit : > i am a user of tomee 1.7.2 plus .and 1.7.4 plus and 7.0.2 plus . > > I have tried to generate a crud web app. > > Into my domain model i have for example a entity Customer with @OneToMany > Collection<Order> collectionOrders. > > And a Entity Order with @ManyToOne Customer customer. > > I would use the default lazy fetch type for orderscollection into Customer > entity. > > > From a view jsf page i show the list of customer inside a table > > When i click on the row , with ajax i set the selected customer into the > viewScoped customerController . > > > So into the customerController i call a EJBFacede and i reattach the > custoemer to em and retrive > the orderslist.. with : > inside the EJB: > > > public Customer reattachandLoadORdersCOllection(Customer > customToReattach){ > Customer attached=em.merge(customToReattach). > > Collcetion<Orders> collection= atrtached.getOrdersCollection(); > > collection.size(); > customToReattach.setOrdersCOllection(collection): > return customToReattach > } > i set the collection to to customer and i return it to controller. > > Into the controller i take the Customer returned from the ejb with > ordersColletion and i set to field Customer selected. > > > > so i you ask please : > On tomee or some github repo it is present a working solution from a Tomee > plus that uses OpenJPA and CDI and has AJAX elements where they need to > access LAZY relationships.? > > OR that show how resolve the lazy loading > > I would understand like resolve the lazi loading with tomee openjpa > > tank you in advance. > Mauro > > > > -- > View this message in context: http://tomee-openejb.979440. > n4.nabble.com/tomee-example-for-resolve-the-problem-of- > lazy-load-tp4680561.html > Sent from the TomEE Users mailing list archive at Nabble.com. >
