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 > > > > > >
