tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howard W. Smith, Jr." <smithh032...@gmail.com>
Subject Re: Entity cant be refreshed with new list values
Date Sat, 19 Oct 2013 13:04:31 GMT
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
<rmannibucau@gmail.com>wrote:

> More i work on apps more i think jpa should be hidden of business
> code...just my opinion. Technically both works
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message