understood. my app is working-as-designed-and-expected, and I am not always using this approach, but i do know when to use it...like you said earlier, if/when it is needed in the UI.
now i know, and I can use this approach on need-only basis, thanks. :) On Sat, Oct 19, 2013 at 11:37 AM, Mark Struberg <[email protected]> wrote: > Nope, there is nothing in the spec which defines that it will really load > all the entities. > The only thing which guarantees this is by really iterating over all the > items in the list and even touch all the lazy attributes in those items if > you need them. > > LieGrue, > strub > > > > > ----- Original Message ----- > > From: "Howard W. Smith, Jr." <[email protected]> > > To: [email protected] > > Cc: > > Sent: Saturday, 19 October 2013, 16:29 > > Subject: Re: Entity cant be refreshed with new list values > > > > so isEmpty() and size() is a hack and not recommended as touching in > > standard EJBs? > > > > > > > > > > On Sat, Oct 19, 2013 at 10:23 AM, Romain Manni-Bucau > > <[email protected]>wrote: > > > >> IsEmpty or size hack is not portablr > >> Le 19 oct. 2013 15:04, "Howard W. Smith, Jr." > > <[email protected]> a > >> écrit : > >> > >> > I agree. I only do/use JPA inside of @EJB's. I learned to do that > > by > >> using > >> > NetBeans, since they generate entire web app from your database. > >> > > >> > but i need to 'touch' all related List/Collections inside of > > the 1st @EJB > >> > that retrieves the @Entity and returns to other layer of app. what i > > am > >> > currently doing is the following: > >> > > >> > 1. Orders order = (@EJB) facade.getOrder(); > >> > > >> > 2. List<Origins> origins = (@EJB) > >> > originFacade.getListOfOriginsForOrder(order.orderId) > >> > > >> > 3. order.setOrigins(new ArrayList<>(origins)); > >> > > >> > yes, it works, but I think you (and Mark) are telling me what I > > learned > >> in > >> > this thread... populate Orders.origins inside of > > OrdersFacade.getOrder() > >> > via isEmpty() or size(). that might be a bit more efficient, but is > > this > >> > the only way to 'touch' all the List/collections related to > > @Entity > >> > (Orders) ? > >> > > >> > i guess i don't like the look/requirement that I have to do > > something > >> like > >> > this below inside @EJB > >> > > >> > if (orders.getOrigins() != null && > > !orders.getOrigins().isEmpty()) { > >> > // this is just to touch origins, now go on to the next IF block > >> > } > >> > > >> > if (orders.getDestinations() != null && > >> > !orders.getDestinations().isEmpty()) { > >> > // this is just to touch destinations, now go on to the next IF > > block > >> > } > >> > > >> > ... > >> > > >> > > >> > On Sat, Oct 19, 2013 at 8:49 AM, Romain Manni-Bucau > >> > <[email protected]>wrote: > >> > > >> > > More i work on apps more i think jpa should be hidden of business > >> > > code...just my opinion. Technically both works > >> > > > >> > > >> > > >
